title: Python: functions to change values 'in place'?
body: <p>I'd like to implement a function that allows the values of its arguments to be reallocated 'in place'. </p>
  
  <p>As an example, a function that will increment argument <em>x</em> and decrement argument <em>y</em>. (This is just a simple example for illustration - the motivation is that <em>X</em> and <em>Y</em> are in fact single elements of a large dataframe; their expressions are unwieldy; and this operation will undergo many iterations.)</p>
  
  <pre><code>def incdec(x,y,d):
      x += d
      y -= d
  </code></pre>
  
  <p>Ideally this would be run as:</p>
  
  <pre><code>X = 5; Y = 7; d = 2
  incdec(X,Y,d)
  </code></pre>
  
  <p>to find that the values are now <em>X</em> = 7 and <em>Y</em> = 5. But of course it doesn't work like that - I wondered why?</p>