Is python tuple assignment order fixed?
<p>Will</p>

<pre><code>a, a = 2, 1
</code></pre>

<p>always result in a equal to 1? In other words, is tuple assignment guaranteed to be left-to-right?</p>

<p>The matter becomes relevant when we don't have just a, but a[i], a[j] and i and j may or may not be equal.</p>

<p>Yes, it is part of the python language reference that tuple assignment must take place left to right. </p>

<p><a href="https://docs.python.org/2.3/ref/assignment.html">https://docs.python.org/2.3/ref/assignment.html</a></p>

<blockquote>
  <p>An assignment statement evaluates the expression list (remember that
  this can be a single expression or a comma-separated list, the latter
  yielding a tuple) and assigns the single resulting object to each of
  the target lists, from left to right.</p>
</blockquote>

<p>So all Python implementations should follow this rule (as confirmed by the experiments in the other answer). </p>

<p>Personally, I would still be hesitant to use this as it seems unclear to a future reader of the code. </p>

python tuples variable-assignment