[Python-Dev] Alternative implementation of string interning

Fredrik Lundh fredrik@pythonware.com
Tue, 2 Jul 2002 13:18:31 +0200


Oren Tirosh wrote:

> Even this is not a problem yet unless the code also expects that if =
the
> same string is ever interned again it will get the same integer id and =
breaks
> if it doesn't.  I can't believe anyone is stupid enough to do that.

do what?  trust the documentation?

    intern(string)=20
  Enter string in the table of ``interned'' strings and return the
  interned string - which is string itself or a copy. /.../ Interned
  strings are immortal (never get garbage collected).
</F>