[Python-Dev] Alternative implementation of string interning
Oren Tirosh
oren-py-d@hishome.net
Mon, 1 Jul 2002 16:18:41 -0400
http://python.org/sf/576101
Interning is done using a flag instead of a pointer (3 bytes less). The
ob_sinterned pointer was most of the time either NULL or pointing to the
same object. Cases where it pointed to another object were rare and the
code that was cheching for this case was not effective.
Interned strings are no longer immortal. They die when their refcnt
reaches 0 just like any other object. The reference from the interned dict
will not keep them alive longer than necessary.
Can anyone explain why they were implemented with a pointer in the first
place? Barry?
Oren