[issue43947] lambdas stored with assignment expressions are unoptimized

Ken Jin report at bugs.python.org
Tue Apr 27 10:51:57 EDT 2021


Ken Jin <kenjin4096 at gmail.com> added the comment:

I'm unable to reproduce it on 3.10:

>>> regass = lambda k: k in {None}
>>> dis.dis(regass)
  1           0 LOAD_FAST                0 (k)
              2 LOAD_CONST               1 (frozenset({None}))
              4 CONTAINS_OP              0
              6 RETURN_VALUE
>>> dis.dis(walrus:=lambda k: k in {None})
  1           0 LOAD_FAST                0 (k)
              2 LOAD_CONST               1 (frozenset({None}))
              4 CONTAINS_OP              0
              6 RETURN_VALUE

On 3.9 and 3.8, I'm able to reproduce your bug.

----------
nosy: +kj
versions:  -Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43947>
_______________________________________


More information about the Python-bugs-list mailing list