[Python-ideas] string codes & substring equality

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Nov 30 23:13:25 CET 2013


spir wrote:
> Which strings, if any, are interned in Python (I'd bet, for 
> lookup speed, __dict__ key, meaning id's, meaning var & attr names)?

Yes, identifiers are interned, and also short string
literals that resemble identifiers (since they might
get used in getattr calls and the like).

But as far as I know, it's never done for strings
constructed at run time unless you explicitly ask
for it. So it wouldn't help for what we've been
talking about.

-- 
Greg


More information about the Python-ideas mailing list