title: Python Variable Scope (passing by reference or copy?)
body: <p>Why does the variable L gets manipulated in the <code>sorting(L)</code> function call?  In other languages, a copy of L would be passed through to <code>sorting()</code> as a copy so that any changes to <code>x</code> would not change the original variable?  </p>
  
  <pre><code>def sorting(x):
      A = x #Passed by reference?
      A.sort() 
  
  def testScope(): 
      L = [5,4,3,2,1]
      sorting(L) #Passed by reference?
      return L
  
  &gt;&gt;&gt; print testScope()
  
  &gt;&gt;&gt; [1, 2, 3, 4, 5]
  </code></pre>