[Python-Dev] Alternative implementation of interning

Greg Ewing greg@cosc.canterbury.ac.nz
Fri, 16 Aug 2002 12:51:51 +1200 (NZST)


>  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

If you wrote something like that *expecting* the strings
to be immortal, there would be no reason to bother with
the ids -- just keep references to the strings themselves.

If you *weren't* expecting them to be immortal, there would
be no reason to expect the ids to be equal anyway.

So I agree -- it's not a problem.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg@cosc.canterbury.ac.nz	   +--------------------------------------+