257 is 257 + 0

October 16th, 2010 § 0 comments

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
>>>

What's this?

You are currently reading 257 is 257 + 0 at Dan O'Huiginn.

meta