title: How can I update an attribute created by a base class' mutable default argument, without modifying that argument?
body: <p>I've found a strange issue with subclassing and dictionary updates in new-style classes:</p>
  <pre><code>Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on
  win32
  &gt;&gt;&gt; class a(object):
  ...     def __init__(self, props={}):
  ...             self.props = props
  ...
  &gt;&gt;&gt; class b(a):
  ...     def __init__(self, val = None):
  ...             super(b, self).__init__()
  ...             self.props.update({'arg': val})
  ...
  &gt;&gt;&gt; class c(b):
  ...     def __init__(self, val):
  ...             super(c, self).__init__(val)
  ...
  &gt;&gt;&gt; b_inst = b(2)
  &gt;&gt;&gt; b_inst.props
  {'arg': 2}
  &gt;&gt;&gt; c_inst = c(3)
  &gt;&gt;&gt; c_inst.props
  {'arg': 3}
  &gt;&gt;&gt; b_inst.props
  {'arg': 3}
  &gt;&gt;&gt;
  </code></pre>
  <p>In debug, in second call (<code>c(3)</code>) you can see that within <code>a</code> constructor <code>self.props</code> is already equal to <code>{'arg': 2}</code>, and when <code>b</code> constructor is called after that, it becomes <code>{'arg': 3}</code> for both objects!</p>
  <p>also, the order of constructors calling  is:</p>
  <pre><code>  a, b    # for b(2)
    c, a, b # for c(3)
  </code></pre>
  <p>If you replace <code>self.props.update()</code> with <code>self.props = {'arg': val}</code> in <code>b</code> constructor, everything will be OK, and will act as expected</p>
  <p>But I really need to <em>update</em> this property, not to replace it.</p>