Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #19312 > unrolled thread

Re: String interning in Python 3 - missing or moved?

Started byTerry Reedy <tjreedy@udel.edu>
First post2012-01-23 23:18 -0500
Last post2012-01-23 23:18 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: String interning in Python 3 - missing or moved? Terry Reedy <tjreedy@udel.edu> - 2012-01-23 23:18 -0500

#19312 — Re: String interning in Python 3 - missing or moved?

FromTerry Reedy <tjreedy@udel.edu>
Date2012-01-23 23:18 -0500
SubjectRe: String interning in Python 3 - missing or moved?
Message-ID<mailman.5006.1327378738.27778.python-list@python.org>
On 1/23/2012 9:25 PM, Chris Rebert wrote:
> On Mon, Jan 23, 2012 at 4:38 PM, Chris Angelico<rosuav@gmail.com>  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`:
> http://docs.python.org/dev/library/sys.html#sys.intern
> Search the "What's New"s in the future.
> http://docs.python.org/release/3.1.3/whatsnew/3.0.html#builtins

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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web