[Python-Dev] Alternative implementation of string interning

Jack Jansen Jack.Jansen@cwi.nl
Tue, 2 Jul 2002 11:17:15 +0200


On Monday, July 1, 2002, at 11:12 , Tim Peters wrote:

> [Oren Tirosh, on <http://python.org/sf/576101>]
>> ...
>> Interned strings are no longer immortal.  They die when their refcnt
>> reaches 0 just like any other object.
>
> This may be a problem.  Code now can rely on that 
> id(some_interned_string)
> stays the same across the life of a run.

The macimport code relies on the ids remaining the same. But it is easy 
to fix (just add an incref). I'll also change it to use 
PyString_CheckInterned.
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma 
Goldman -