title: python assignment in array vs scalar
body: <p>I have a 2D array <code>A</code> of shape <code>(4,3)</code>, and a 1D array <code>a</code> of shape <code>(4,)</code>. I want to swap the first two rows of <code>A</code>, as well as the first two elements in <code>a</code>. I did the following:</p>
  
  <pre><code>A[0,:],A[1,:] = A[1,:],A[0,:]
  a[0],a[1] = a[1],a[0]
  </code></pre>
  
  <p>Apparently, it works for <code>a</code>, but fails for <code>A</code>. Now, the second row becomes the first row, but the first row remains unchanged. If I do the following:</p>
  
  <pre><code>first_row_copy = A[0,:].copy()
  A[0,:] = A[1,:]
  A[1,:] = first_row_copy
  </code></pre>
  
  <p>Then, it seems to work. Why the first method doesn't work? (but works for <code>a</code>) Also, what's the difference between <code>A_copy = A[0,:].copy()</code> and <code>A_copy = A[0,:]</code>?</p>