title: Python Multiple Assignment Statements In One Line
body: <p>(Don't worry, this isn't another question about unpacking tuples.)</p>
  
  <p>In python, a statement like <code>foo = bar = baz = 5</code> assigns the variables foo, bar, and baz to 5.  It assigns these variables from left to right, as can be proved by nastier examples like</p>
  
  <pre><code>&gt;&gt;&gt; foo[0] = foo = [0]
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  NameError: name 'foo' is not defined
  &gt;&gt;&gt; foo = foo[0] = [0]
  &gt;&gt;&gt; foo
  [[...]]
  &gt;&gt;&gt; foo[0]
  [[...]]
  &gt;&gt;&gt; foo is foo[0]
  True
  </code></pre>
  
  <p>But the <a href="http://docs.python.org/2/reference/simple_stmts.html#assignment-statements">python language reference</a> states that assignment statements have the form </p>
  
  <pre><code>(target_list "=")+ (expression_list | yield_expression)
  </code></pre>
  
  <p>and on assignment the <code>expression_list</code> is evaluated first and then the assigning happens.</p>
  
  <p>So how can the line <code>foo = bar = 5</code> be valid, given that <code>bar = 5</code> isn't an <code>expression_list</code>?  How are these multiple assignments on one line getting parsed and evaluated?  Am I reading the language reference wrong?</p>