title: Python Default Arguments Evaluation
body: <p>I was reading the python tutorial from Python Documentation Release 2.7.10 and I came across something like this.</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>def fun1(a,L=[]):
      L.append(a)
      return L
  
  print fun1(1)
  print fun1(2)
  print fun1(3)
  
  def fun2(a,L = None):
      if L is None:
          L=[]
      L.append(a)
      return L
  
  print fun2(1)
  print fun2(2)
  print fun2(3)
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>[1]
  [1, 2]
  [1, 2, 3]
  [1]
  [2]
  [3]
  
  Process finished with exit code 0
  </code></pre>
  
  <p>If the <code>L=[]</code> in the first function <code>fun1()</code> is getting called only once , the output of <code>fun1()</code>is fine. But then why <code>L=None</code> is getting called every time in <code>fun2()</code>.</p>