Re:Facts and myths about Python names and values
by audeyisaacs on Sunday July 14, 2013 @02:04PM
(#6041576)
For more details:
http://stackoverflow.com/questions/306313/python-is-operator...
Re:Facts and myths about Python names and values
by nslocum on Sunday July 14, 2013 @02:27PM
(#6041660)
After a little trial and error, it appears that Python caches the values in range(-5,257).
> -6 + 0 is -6
False
> -5 + 0 is -5
True
> 256 + 0 is 256
True
> 257 + 0 is 257
False
Re:Facts and myths about Python names and values
by wahnfrieden on Sunday July 14, 2013 @04:43PM
(#6042166)
(CPython)
Re:Facts and myths about Python names and values
by Thrymr on Sunday July 14, 2013 @01:11PM
(#6041402)
> 2 + 4 is 4
True
I sure hope not.
Further, there are some odd quirks because of the way Python caches small Integers for efficiency.