the parameter passing behavior in python function in Python
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/986006/python-how-do-i-pass-a-variable-by-reference">Python: How do I pass a variable by reference?</a>  </p>
</blockquote>



<p>I want to test the parameter passing behavior in python function by the following 2 functions:</p>

<p>In:</p>

<pre><code>def f(a):
        a[0]=3
        print 'in f ',a
a=[1,2]
print 'ori ',a
f(a)
print 'now ',a
</code></pre>

<p>It turned out the "a" has been modified after returning from f().</p>

<p>However, in:</p>

<pre><code>import numpy as np
def f(a):
        a=np.array(a,np.float)
        print 'in f ',a
a=[1,2]
print 'ori ',a
f(a)
print 'now ',a
</code></pre>

<p>I found that "a" was not changed to numpy array after returning from f().</p>

<p>Can somebody give some explanations?</p>
