Python "is" behavior

Jean-Paul Calderone exarkun at divmod.com
Fri Jun 20 12:38:56 EDT 2008


On Fri, 20 Jun 2008 09:31:57 -0700 (PDT), michalis.avraam at gmail.com wrote:
>I am not certain why this is the case, but...
>
>>>> a = 256
>>>> b = 256
>>>> a is b
>True
>
>>>> a = 257
>>>> b = 257
>>>> a is b
>False
>
>Can anyone explain this further? Why does it happen? 8-bit integer
>differences?

http://mail.python.org/pipermail/python-list/2001-November/113994.html

Jean-Paul



More information about the Python-list mailing list