title: Python list's reference do not change in function
body: <p>Here are my test codes.</p>
  
  <p><strong>Test 1</strong>:</p>
  
  <pre><code>def set(object):
      object = [2,3]
  a = [1,3]
  set(a)
  print a 
  </code></pre>
  
  <p>The output is <strong>[1,3]</strong></p>
  
  <p><strong>Test 2</strong>:</p>
  
  <pre><code>def set(object):
      object[0] = 2
  a = [1,3]
  set(a)
  print a
  </code></pre>
  
  <p>The output is <strong>[2,3]</strong></p>
  
  <p>For <strong>Test 2</strong>, I can know it well, because <code>a</code> is a list, which transfer reference in python. So when call <code>set(object)</code>, <code>object</code> is a reference of <code>a</code>. Therefore <code>a</code> change into <code>[2,3]</code>.
  But for <strong>Test 1</strong>, I have not knew it well. I think the answer is <code>[2,3]</code>, but the real answer is <code>[1,3]</code>. Can anyone tell me the two test case's differences?</p>