Seemingly odd 'is' comparison.
Terry Reedy
tjreedy at udel.edu
Mon Feb 18 21:45:35 EST 2008
More information about the Python-list mailing list
Mon Feb 18 21:45:35 EST 2008
- Previous message (by thread): Seemingly odd 'is' comparison.
- Next message (by thread): Seemingly odd 'is' comparison.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Asun Friere" <afriere at yahoo.co.uk> wrote in message news:8cafcd9e-6a61-483f-b8f3-6e7b0e5ab435 at s8g2000prg.googlegroups.com... | 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), They may or may not be. But for almost all purposes, that is irrelevant. | or tuples, since they potentially could be, seems sound enough. Ditto for tuples, unless possibly when they have mutable members. | But given the nature of | immutables, is the identity of these even potentially implementation | dependant (ie. they couldn't be interred could they)? The word is 'interned', not 'interred' (buried). | 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. Lists are mutable, and identity is often important. Id(list) can be used to debug or solve puzzling behavior. tjr
- Previous message (by thread): Seemingly odd 'is' comparison.
- Next message (by thread): Seemingly odd 'is' comparison.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list