Emile van Sebille wrote:
On 4/28/2010 3:20 AM Walter Wefft said...
spir ☣ wrote:
On Wed, 28 Apr 2010 07:53:06 +0100
Walter Wefft <walterwe...@googlemail.com> wrote:
<snip>
===============================
class MyDict0(dict):
pass
class MyDict1(dict):
def __init__(self, *args, **kw):
pass
class MyDict2(dict):
def __init__(self, *args, **kw):
dict.__init__(self, *args, **kw)
===============================

d0 = MyDict0(a=1) ; d1 = MyDict1(a=1) ; d2 = MyDict2(a=1)
print d0,d1,d2 # ==> {'a': 1} {} {'a': 1}


You reiterate my point. To say that dict.__init__ can be omitted in a
subclass's __init__ with no effect, is not a correct statement.


It wasn't the omitted case that exhibits the difference. When sub-classing, any methods omitted defer to the parent's version so the init from the dict parent happened.


"omitted in a subclass's __init__", ie. a *call* to the superclass's method

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to