[Python-Dev] Alternative implementation of interning

Tim Peters tim@zope.com
Thu, 15 Aug 2002 12:46:25 -0400


[Guido]
> I'd like to make all interned strings mortal; this allows some
> simplifications to the patch.  This would mean that in the following
> example:
>
>   x = intern('12345'*4)
>   nx = id(x)
>   del x
>   ...do something else...
>   y = intern('12345'*4)
>   ny = id(y)
>
> nx doesn't necessarily equal ny any more.  This is a backward
> incompatibility but I'm willing to break programs that rely on this;
> it sounds highly unlikely that the author of any such code as exists
> would mind it being broken.
>
> Opinions?

As the only person to have posted an example relying on this behavior, it's
OK by me if that example breaks -- it was made up just to illustrate the
possibility and raise a caution flag.  I don't take it seriously.

> (Reminder: this is python-dev, not types-sig. :-)

Oops!  I guess I should take it more seriously then <wink>.