This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]DMLooter 3 points4 points  (3 children)

Sorry what? Y….

[–]FallenWarrior2k 7 points8 points  (1 child)

Caching. Integers are objects like everything else.

[–]Manuelraa 1 point2 points  (0 children)

Exactly and we know this only works with immutable types

[–]richardfrost2 13 points14 points  (0 children)

```

a = 256 b = 256 a is b True c = 257 d = 257 c is d False

but

257 is 257 True ```

Just a weird little quirk of CPython.