3 ms·
This is because all integers between -5 and 256 in CPython are "cached", so they all have the same identity (hence the True return value of the `is` of the seco
by garindra 14y ago
This is because all integers between -5 and 256 in CPython are "cached", so they all have the same identity (hence the True return value of the `is` of the second comparison -- it's between the range).
http://stackoverflow.com/questions/306313/python-is-operator-behaves-unexpectedly-with-integers http://stackoverflow.com/questions/306313/python-is-operator...