[Tutor] Superclass call problem
Alan Harris-Reid
aharrisreid at googlemail.com
Sat Feb 20 18:50:49 CET 2010
Hi,
I am having trouble understanding how superclass calls work. Here's
some code...
class ParentClass():
def __init__(self):
do something here
class ChildClass(ParentClass):
def __init__(self):
super().__init__(self) # call parentclass
__init__ method
do something else here
When the super().__init__ line runs I get the error "__init__() takes
exactly 1 positional argument (2 given)"
Can anyone tell me where I have gone wrong? I thought the self
parameter should be passed to all class methods.
TIA
Alan Harris-Reid
More information about the Tutor
mailing list