[Python-ideas] Keyword/Symbol literals

Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Jan 22 03:13:20 CET 2015


Sorry, I misread what you wrote.  I thought you suggested that an interned
string can get "uninterned" somehow.  Yes, sys.intern(x) will change x's
status, but as you suggested, it can change x.__class__ as well.  However,
with a Symbol class in-place, I don't think there will be a need for such
transitions.  Even now, I don't see sys.intern() in user code too often.

On Wed, Jan 21, 2015 at 9:08 PM, Alexander Belopolsky <
alexander.belopolsky at gmail.com> wrote:

>
> On Wed, Jan 21, 2015 at 5:18 PM, Greg Ewing <greg.ewing at canterbury.ac.nz>
> wrote:
>
>> Alexander Belopolsky wrote:
>>
>>>
>>> Why can't we make interned strings a subclass of strings like bool is a
>>> subclass of int?
>>>
>>
>> Because a string can change from being non-interned to
>> being interned at some point in its life.
>
>
> I did not know that.  Can you show the code that would cause such a change?
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150121/44ec0a4c/attachment.html>


More information about the Python-ideas mailing list