[EMAIL PROTECTED] wrote: > 'Learning Python' by Lutz and Ascher (excellent book by the way) > explains that a subclass can call its superclass constructor as > follows: > (snip) > > Now, this is fine using the above code. Where I'm struggling is with > argument passing. The following, for example, doesn't seem to work: > > class Super: > def __init__(self, **kargs): > self.data = kargs > > class Extender(Super): > def __init__(self, **kargs): > Super.__init__(self, kargs) # call the constructor method in Super > # do additional extender-specific stuff here > > What am I doing wrong? I get: > TypeError: __init__() takes exactly 1 argument (2 given) > WARNING: Failure executing file: <main.py> >
class Super(object): def __init__(self, **kwargs): self.data = kwargs class Extender(Super): def __init__(self, **kwargs): Super.__init__(self, **kwargs) # do additional extender-specific stuff here HTH -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list