interning strings

"Martin v. Löwis" martin at v.loewis.de
Sun Nov 7 13:30:54 EST 2004


Peter Otten wrote:
> String constants that are potential attribute names are also interned:

Peter has explained all this correctly, but this aspect needs some
stressing perhaps: string *literals* that are potential attribute
names are also interned. This interning is done in the compiler,
when the code object is created, so strings not created by the compiler
are not interned.

[all strings are "constant", i.e. immutable, so the statement
  above might have been confusing]

Regards,
Martin



More information about the Python-list mailing list