title: Python functions call by reference
body: <p>In some languages you can pass a parameter by reference or value by using a special reserved word like <strong>ref</strong> or <strong>val</strong>. When you pass a parameter to a Python function it never alters the value of the parameter on leaving the function.The only way to do this is by using the <strong>global</strong> reserved word (or as i understand it currently).</p>
  <p><em>Example 1:</em></p>
  <pre><code>k = 2
  
  def foo (n):
       n = n * n     #clarity regarding comment below
       square = n
       return square
  
  j = foo(k)
  print j
  print k
  </code></pre>
  <p>would show</p>
  <pre><code>&gt;&gt;4
  &gt;&gt;2
  </code></pre>
  <p>showing k to be unchanged.</p>
  <p>In this example the variable n is never changed</p>
  <p><em>Example 2:</em></p>
  <pre><code>n = 0
  def foo():
      global n
      n = n * n
      return n
  </code></pre>
  <p>In this example the variable n is changed.</p>
  <p>Is there any way in Python to call a function and tell Python that <strong>the parameter</strong> is either <strong>a value</strong> or <strong>reference</strong> parameter instead of using global?</p>