'is' versus '=='
Isaac To Kar Keung
kkto at csis.hku.hk
Mon May 7 22:53:26 EDT 2001
>>>>> "Alan" == Alan Daniels <daniels at alandaniels dot com> writes:
Alan> As an example (if I recall correctly), the integers 0 through 100
Alan> are pre-created since they're used in code so often.
Actually, -1 through 99...
>>> a=100
>>> b=100
>>> a is b
0
>>> a=99
>>> b=99
>>> a is b
1
>>> a=-1
>>> b=-1
>>> a is b
1
>>> a=-2
>>> b=-2
>>> a is b
0
Regards,
Isaac.
More information about the Python-list
mailing list