Batuhan Taskaya <isidenti...@gmail.com> added the comment:

Due to the precedence of the walrus operator, it is not actually a multiple 
assignment but rather a tuple of 3 elements with one being the value of the 
assignment expression.

 $ python -m ast  
(a, b := 3, 4)
Module(
   body=[
      Expr(
         value=Tuple(
            elts=[
               Name(id='a', ctx=Load()),
               NamedExpr(
                  target=Name(id='b', ctx=Store()),
                  value=Constant(value=3)),
               Constant(value=4)],
            ctx=Load()))],
   type_ignores=[])

In this case, it creates a tuple with loading the name `a` from the current 
scope, using the value of the 3 and also assigning 3 to the b, and loading 
constant 4.

So basically (a, b := 3, 4) is actually (a, (b := 3), 4)

----------
nosy: +BTaskaya

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42295>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to