[Python-ideas] Checking interned string after stringobjects concat?

Guido van Rossum gvanrossum at gmail.com
Sat Apr 21 15:12:44 EDT 2018


But to the OP, this is not considered a bug.

On Sat, Apr 21, 2018, 07:59 Serhiy Storchaka <storchaka at gmail.com> wrote:

> 21.04.18 17:47, Chris Angelico пише:
> > On Sat, Apr 21, 2018 at 10:29 PM, Serhiy Storchaka <storchaka at gmail.com>
> wrote:
> >> 21.04.18 13:42, Chris Angelico пише:
> >>>
> >>> What you're seeing there is actually the peephole optimizer at work.
> >>
> >>
> >> Since 3.7 constant folding is the AST optimizer work. The end result is
> the
> >> same in most cases though.
> >>
> >> Other optimization takes place here too. Constants strings that look
> like
> >> identifiers (short string consisting of ASCII alphanumerical
> characters) are
> >> interned in the code object constructor.
> >
> > Ah, sorry, my bad. Anyhow, it's part of compile-time optimization,
> > which means that it runs the exact same code for both assignments.
>
> Don't blame yourself for missing details of the implementation of the
> version that is not released yet. ;-)
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180421/cddb7903/attachment.html>


More information about the Python-ideas mailing list