Seemingly odd 'is' comparison.

Asun Friere afriere at yahoo.co.uk
Mon Feb 18 20:27:44 EST 2008


On Feb 19, 9:44 am, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:

> Except for documented singletons such as modules and None, which objects
> have the same identity is platform dependent, version dependent, and even
> dependent on the execution history of your code.

The advice not to identity test strings and numbers (since they are
interred in the main implementation), or tuples, since they
potentially could be, seems sound enough.  But given the nature of
immutables, is the identity of these even potentially implementation
dependant (ie. they couldn't be interred could they)?  One might
conceivably want to know that a list into which one is about to stuff
something is the same (or perhaps not the same) list as that pointed
to by another name, which operation, hopefully, remains possible
across the range of potential implementations.



More information about the Python-list mailing list