title: What did "append" do to my parameter outside the function?
body: <p>Given a simple example:</p>
  <pre class="lang-py prettyprint-override"><code>def change(a,b=[]):
      a+=1
      b.append(1)
  A = 1
  B = []
  </code></pre>
  <p>guess what happens if we:</p>
  <pre class="lang-py prettyprint-override"><code>change(A,B)
  print(A, B)
  </code></pre>
  <blockquote>
  <p>2 [1]</p>
  </blockquote>
  <p>The parameter B outside the function, is changed!</p>
  <p>But why could that <code> b.append(1)</code> affect the parameter outside the function?</p>