title: Iterating over a list of arrays and change list elements through iterator
body: <p>I came across a piece of code which to my understanding should not have worked. I am looping over a list of Numpy arrays and want to clip its content. For the manipulation of the list the iterator is used.</p>
  
  <p>To my understanding the iterator of a for-loop gets assigned the values in the list. Hence, changing the value of the iterator should not affect the list itself.
  In the shown code example the numpy function clip is used and the iterator is assigned to the out parameter for in-place clipping.
  Similar to this I do the same for some numbers and use the in-place operator iadd.</p>
  
  <pre class="lang-py prettyprint-override"><code>#Clip the arrays
  a=np.array([4,5,1])
  b=np.array([-4,3,-2])
  c=np.array([3,4,-5])
  print("Array before clipping:",a,b,c)
  for iterator in [a, b, c]:
     np.clip(iterator, -3,3,out=iterator)
  print("Array after clipping:",a,b,c)
  
  #doing in-place calculation
  d=3
  e=4
  print("Numbers before clipping:",d,e)
  for iterator2 in [d,e]:
      iterator2 = operator.iadd(iterator2,2)
  print("Numbers after clipping:",d,e)
  </code></pre>
  
  <p>I would expect the lists not to be changed. Even the in place operation can only manipulate the memory location of the iterator. However, for the clipping case the list is changed. How can that be?</p>
  
  <p>Array before clipping: </p>
  
  <pre><code>[4 5 1] [-4  3 -2] [ 3  4 -5]
  </code></pre>
  
  <p>Array after clipping: </p>
  
  <pre><code>[3 3 1] [-3  3 -2] [ 3  3 -3]
  </code></pre>
  
  <p>Numbers before clipping:</p>
  
  <pre><code>3 4
  </code></pre>
  
  <p>Numbers after clipping:</p>
  
  <pre><code>3 4
  </code></pre>