String interning in Python 3 - missing or moved?

Terry Reedy tjreedy at
Mon Jan 23 23:18:39 EST 2012

On 1/23/2012 9:25 PM, Chris Rebert wrote:
> On Mon, Jan 23, 2012 at 4:38 PM, Chris Angelico<rosuav at>  wrote:
>> 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?
> The former, into `sys`:
> Search the "What's New"s in the future.

I think that the devs decided that interning is a minor internal 
optimization that users generally should not fiddle with (especially how 
that so much is done automatically anyway*), while having it a builtin 
made it look like something they should pay attention to.

*I am not sure but what hashes for strings either are or in 3.3 will 
always be cached.

Terry Jan Reedy

More information about the Python-list mailing list