Parent __init__ class variable being shared among all child instances
<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 am confused with the following. I have a base class:</p>

<pre><code>class MyBase:

    def __init__(self, store=set()):
        self._store = store
</code></pre>

<hr>

<p>Now child classes inherit MyBase</p>

<pre><code>class Child1(MyBase):
    pass

class Child2(MyBase)
    pass
</code></pre>

<hr>

<p>Then,</p>

<pre><code>child1 = Child1()
child2 = Child2()

print(id(child1._store) = id(child2._store))
&gt;&gt;&gt; True
</code></pre>

<p>Why do these instances have a shared _store??</p>

<p>I would really appreciate if you could help me out.</p>

<p>Regards,
Nav</p>
