title: Function is changing wrong variable
body: <p>I have got a problem that changes wrong variable in a function(s) shown below.</p>
  
  <pre><code>def no_updown() -&gt; int:
      print(g.matrix)
      count = 0
      arr = g.matrix
      arr = g.move_elements(arr)
      for x in range(g.size):
          for y in range(g.size - 1):
              if arr[y, x] == arr[y + 1, x] and arr[y, x] &gt; 0:
                  arr[y, x] *= 2
                  arr[y + 1, x] = 0
                  count += 1
      return count
  </code></pre>
  
  <p>And here is <em>g.move_elements</em>:</p>
  
  <pre><code>def move_elements(self, arr) -&gt; np.matrix:
      for x in range(self.size):
          temp = 0
          for y in range(self.size):
              if not arr[y, x] == 0:
                  arr[temp, x] = arr[y, x]
                  if not temp == y:
                      arr[y, x] = 0
                  temp += 1
      return arr
  </code></pre>
  
  <p>I want to operate only on <em>arr</em> from <em>no_updown()</em>. Instead what am I getting is <em>g.matrix</em> changed. I believe this has something to do with referencing, but I don't know quietly what.</p>