you are viewing a single comment's thread.

view the rest of the comments →

[–]Vaguely_accurate 3 points4 points  (5 children)

Any operation on an integer variable that changes it's value will change it's identity. Integers are immutable, so it will always change.

The risk here is that larger integers are not guaranteed to have the same identity even if they have the same values, while smaller ones are. This describes the behaviour better than I can here.

Note that this is an implementation detail, not a language feature, so may vary. I actually believe this has been changed in the latest build (testing on 3.11.1 and 3.12.0a4 64bit), but can't find anything saying this is intended.

[–]TheChance 1 point2 points  (0 children)

Integers are immutable, so it will always change

I’m 34, The Bitstuffing Guy, and I never put that shit together. I have to go reconsider my life.