inhibit sharing default arg b/w successive calls
<p><a href="http://docs.python.org/tutorial/controlflow.html#default-argument-values" rel="nofollow">Python Tutorial</a> -</p>

<blockquote>
  <p><strong>Important warning:</strong> The default value is evaluated only once 
  ...
  If you don’t want the default to be
  shared between subsequent calls, you
  can write the  function like this
  instead:</p>
</blockquote>

<pre><code>def f(a, L=None):
    if L is None:
        L = []
    L.append(a)
    return L
</code></pre>

<p>I still was expecting:</p>

<pre><code>print f(1)    # [1]
print f(2)    # [1,2]
print f(3)    # [1,2,3]
</code></pre>

<p>I reason:</p>

<p>The default value (<code>L=None</code>) was executed for <code>f(1)</code> which helped L point to a new empty list in the fn body. However on successive calls, <code>L=None</code> was not executed; so L still points to the list which already has 1 in it now, and subsequent calls are simply appending more elements to it thereby sharing <code>L</code>. </p>

<p>Where am I thinking incorrectly?</p>

<hr>

<p><strong>UPDATE</strong></p>

<pre><code>def f(a, L=[]):
    L.append(a)
    return L
</code></pre>

<p>Does L here point to an empty list created in heap or stack?</p>
