[Python-ideas] Keyword/Symbol literals

Chris Angelico rosuav at gmail.com
Wed Jan 21 23:30:42 CET 2015

On Thu, Jan 22, 2015 at 9:24 AM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Chris Angelico wrote:
>> If, in the fourth example, the interpreter knew that both those string
>> objects were interned, it could know that they can't possibly be the
>> same string. So is that distinction worth coding into the class
>> hierarchy?
> I believe there is a flag in the string object indicating
> that it is interned, so the interpreter *does* know this.
> It's just not visible to Python code.

Huh. Okay. It's not made use of for optimizing the == operator, which
ought to be easy to do. Or is the cost of checking not worth it?


More information about the Python-ideas mailing list