String interning in Python 3 - missing or moved?

Chris Angelico rosuav at
Mon Jan 23 19:38:36 EST 2012

Python 2 can intern 'str' (bytes) strings (with the eponymous builtin,
and with C API functions), though not unicode. Python 3 does not have
that builtin, nor the C API; I can't find any support for either str
or bytes.

Has it been moved, or is interning as a concept deprecated?

I don't have a use case, just curiosity at the moment - looking into
various languages' dictionary/mapping implementations (Python hashes
strings for each dict, Lua interns them - by basically putting them
all into one huge hashtable).


More information about the Python-list mailing list