Puzzled by "is"

Bill Scherer bill.scherer at verizonwireless.com
Thu Aug 9 13:46:53 EDT 2007


Dick Moores wrote:
>  >>> () is ()
> True
>  >>> (1,) is (1,)
> False
>
> Why?
>   

>>> a = ()
>>> b = ()
>>> c = (1,)
>>> d = (1,)
>>> a is b
True
>>> c is d
False
>>> id(a)
3086553132
>>> id(b)
3086553132
>>> id(c)
3086411340
>>> id(d)
3086390892


There is only one empty tuple.
Does that clear it up for you?

> Thanks,
>
> Dick Moores
>
>   



More information about the Python-list mailing list