Mutable default arguments in Python
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1132941/least-astonishment-in-python-the-mutable-default-argument">&ldquo;Least Astonishment&rdquo; in Python: The Mutable Default Argument</a>  </p>
</blockquote>



<p>I have written the following python program:</p>

<pre><code>#!/usr/bin/env python

def bug( numbers = [] ):
    numbers.append( 1 )
    return numbers

print bug()
print bug()
</code></pre>

<p>The result i would expect is</p>

<pre><code>[1]
[1]
</code></pre>

<p>But i got</p>

<pre><code>[1]
[1, 1]
</code></pre>

<p>Is this a bug?</p>
