Checking interned string after stringobjects concat?

Hi all: I notice that if concatenating two stringobjects, PVM will not check the dictionary of interned string. For example:
But if concatenating two string directly, PVM would check the dictionary:
It happens in Py2 and Py3 both. Is it necessary for fixing this bug or not? Cheers! --- Yinbin

On Sat, Apr 21, 2018 at 8:25 PM, Yinbin Ma <mayinbing12@gmail.com> wrote:
What you're seeing there is actually the peephole optimizer at work. Your assignment to 'b' here is actually the exact same thing as 'a', by the time you get to execution. If you're curious about what's happening, check out the dis.dis() function and have fun! :) ChrisA

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.

On Sat, Apr 21, 2018 at 8:25 PM, Yinbin Ma <mayinbing12@gmail.com> wrote:
What you're seeing there is actually the peephole optimizer at work. Your assignment to 'b' here is actually the exact same thing as 'a', by the time you get to execution. If you're curious about what's happening, check out the dis.dis() function and have fun! :) ChrisA

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.
participants (5)
-
Chris Angelico
-
Guido van Rossum
-
Paul Moore
-
Serhiy Storchaka
-
Yinbin Ma