title: Python: difference between `a,b=[1,2],a` and `a=[1,2]; b=a`?
body: <p>In my understanding, the above two pieces of code should have the same effect. But why when I let a point to another array, the results could be different? The following code illustrates the difference:</p>
  <pre class="lang-py prettyprint-override"><code># part 1
  a=[1,2]
  b=a
  a=a+[3] # a points to a new array. b should still points to [1,2]
  print(a, b) # [1, 2, 3] [1, 2]. My expected result.
  
  # part 2
  a,b=[1,2],a
  a=a+[3] # a points to a new array. b should still points to [1,2]
  print(a, b) # [1, 2, 3] [1, 2, 3]. Why the result is different from the above?
  </code></pre>
  <p>I'm surprised by the result of the part 2. Could someone please explain why the results are different? Thank you so much in advance!</p>
  <p>EDIT: Thank you so much for everyone! Now I understand the problem! Thanks so much!</p>