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>How it works :</p>

<pre><code>a, a = 2, 1
--&gt; a does not exist, create variable a and set value to 2
--&gt; a already exists, value of a changed to 1
</code></pre>

<p>When you have different variables, it works exactly the same way :</p>

<pre><code>a, b, a = 1, 2, 3
--&gt; a does not exist, create variable a and set value to 1
--&gt; b does not exist, create variable b and set value to 2
--&gt; a already exists, value of a changed to 3
</code></pre>

python tuples variable-assignment