Metal Zong wrote:
> The operator is and is not test for object identity: x is y is true if
> and only if x and y are the same objects.
> 
>>>> x = 1
>>>> y = 1
>>>> x is y
> True
> 
> Is this right? Why? Thanks.

I believe Python automatically creates and caches int objects for 0-256,
so whenever you use them, they refer to the same exact objects. Since
ints are immutable, it doesn't matter.
-- 
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to