title: Multiple assignments via walrus := operator?
body: <p>I've attempted to make multiple assignments with the walrus operator, and seen questions on StackOverflow such as <a href="https://stackoverflow.com/questions/59226071/how-to-perform-assignment-destructuring-using-the-walrus-operator-in-python">this</a> which also fail to assign multiple variables using a walrus operator, and am just wondering what a successful multiple assignment would look like, or whether it is not possible.</p>
  
  <p>The purpose of doing so is to add support for detecting all assigned variable names in my library <a href="https://github.com/lmmx/mvdef" rel="noreferrer">mvdef</a> (specifically, within the <a href="https://github.com/lmmx/mvdef/blob/master/mvdef/src/ast_util.py" rel="noreferrer"><code>find_assigned_args</code></a> function in the <code>mvdef.src.ast_util</code> module).</p>
  
  <p>From running <code>ast.parse</code> I can see that the <code>:=</code> operator produces an <code>ast.NamedExpr</code> node, and this has a <code>.target</code> attribute which is an <code>ast.Name</code> object, from which I can obtain the assigned name from the object's <code>.id</code> attribute.</p>
  
  <p>If I had to guess, I'd presume that if it were to be at all possible, the <code>.target</code> attribute would be a list of <code>ast.Name</code> objects instead of a single <code>ast.Name</code> object, however the fact that I can't seem to get an example of this makes me wonder whether it is impossible, at least for the time being (in which case I can simplify my code and not just guess at what an implementation should be).</p>
  
  <p>If anyone knows which specific part of the Python source to look at to tell me if this is possible or not, that'd be helpful, thanks!</p>
  
  <p>P.S. - from looking at the test cases in <code>Lib/test/test_parser.py</code> provided in the <a href="https://github.com/python/cpython/commit/8f59ee01be3d83d5513a9a3f654a237d77d80d9a" rel="noreferrer">initial commit</a> (<a href="https://bugs.python.org/issue35224" rel="noreferrer">via</a>), there don't seem to be examples of multiple assignments with the walrus operator, so I'm going to assume for now it's not possible (but please chime in if I'm wrong!)</p>
  
  <pre class="lang-py prettyprint-override"><code>def test_named_expressions(self):
      self.check_suite("(a := 1)")
      self.check_suite("(a := a)")
      self.check_suite("if (match := pattern.search(data)) is None: pass")
      self.check_suite("[y := f(x), y**2, y**3]")
      self.check_suite("filtered_data = [y for x in data if (y := f(x)) is None]")
      self.check_suite("(y := f(x))")
      self.check_suite("y0 = (y1 := f(x))")
      self.check_suite("foo(x=(y := f(x)))")
      self.check_suite("def foo(answer=(p := 42)): pass")
      self.check_suite("def foo(answer: (p := 42) = 5): pass")
      self.check_suite("lambda: (x := 1)")
      self.check_suite("(x := lambda: 1)")
      self.check_suite("(x := lambda: (y := 1))")  # not in PEP
      self.check_suite("lambda line: (m := re.match(pattern, line)) and m.group(1)")
      self.check_suite("x = (y := 0)")
      self.check_suite("(z:=(y:=(x:=0)))")
      self.check_suite("(info := (name, phone, *rest))")
      self.check_suite("(x:=1,2)")
      self.check_suite("(total := total + tax)")
      self.check_suite("len(lines := f.readlines())")
      self.check_suite("foo(x := 3, cat='vector')")
      self.check_suite("foo(cat=(category := 'vector'))")
      self.check_suite("if any(len(longline := l) &gt;= 100 for l in lines): print(longline)")
      self.check_suite(
          "if env_base := os.environ.get('PYTHONUSERBASE', None): return env_base"
      )
      self.check_suite(
          "if self._is_special and (ans := self._check_nans(context=context)): return ans"
      )
      self.check_suite("foo(b := 2, a=1)")
      self.check_suite("foo(b := 2, a=1)")
      self.check_suite("foo((b := 2), a=1)")
      self.check_suite("foo(c=(b := 2), a=1)")
  
  </code></pre>