[Tutor] Re: When was interned strings dropped (and why)?

Abel Daniel abli at freemail.hu
Fri Jan 30 07:56:01 EST 2004

Daniel Ehrenberg writes:

> Switch to 2.3. That's what I'm using and I don't have
> that bug. Even identical tuples have the same id.

Are you sure?

Python 2.3.3 (#2, Dec 19 2003, 11:28:07) 
[GCC 3.3.3 20031203 (prerelease) (Debian)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> t=(1,2)
>>> tt=(1,2)
>>> t is tt
>>> t == tt
>>> id(t)
>>> id(tt)
>>> ttt=t
>>> id(ttt)

Of course, if you define 'identical' as 'having the same id' then 'identical
tuples have the same id', but you won't really be able to use this fact.

Abel Daniel

More information about the Tutor mailing list