title: Python: How does multiple assignments in a single line work?
body: <p>I know that assignment is a statement in Python, i.e., it doesn't evaluate to a value unlike an expression. How does the following line of code work in Python, then? Please explain what happens internally in the Python interpreter (lexing, parsing, formation of abstract syntax tree).</p>
  
  <pre><code># this works
  spam = eggs = 'ham'
  
  # this doesn't work. Throws SyntaxError
  spam = (eggs = 'ham')
  </code></pre>