257 is 257 + 0

A python gotcha I never knew of before:


Python 2.6.5 (release26-maint, Aug 20 2010, 17:50:24)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 0 is 0 + 0
True
>>> 256 is 256 + 0
True
>>> 257 is 257 + 0
False
>>>

Leave a Reply

Your email address will not be published. Required fields are marked *