Basic Class/Instance Question

Diez B. Roggisch deets at nospam.web.de
Wed May 23 08:18:42 EDT 2007


Siah wrote:

> I think that's because:

No idea what is because of what. Please quote essential parts of the posting
you refer to.
 
>>>> [] is []
> False
>>>> () is ()
> True

This is an implementation artifact. The interpreter chose to create only one
instance for the empty tuple for optimization reasons. But you shouldn't
rely on this. 

For example, for small numbers,

1 is 1

is usually true, but not for larger:

10000000000000 is 10000000000000 

Diez



More information about the Python-list mailing list