[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
False
>>> t == tt
True
>>> id(t)
1075955500
>>> id(tt)
1075798540
>>> ttt=t
>>> id(ttt)
1075955500
>>> 

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