[Tutor] super.__init__() arguments
Hugo Arts
hugo.yoshi at gmail.com
Mon Sep 27 01:55:14 CEST 2010
On Mon, Sep 27, 2010 at 1:45 AM, Jojo Mwebaze <jojo.mwebaze at gmail.com> wrote:
> Hey Tutor,
> Seems a small issue but this has been playing for a while now, what am i
> doing wrong here?
> Take an Example
> Class Point:
> def __init__(self, x=0, y=0):
> self.x = x
> self.y = y
> Class Circle(Point):
> def __init__(self, radius=0, x=0, y=0):
> super().__init__(x, y)
> self.radius = radius
>
> c = Circle(radius =3, x=4, y= 6)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "Point.py", line 13, in __init__
> super().__init__(x, y)
> TypeError: super() takes at least 1 argument (0 given)
>
Did you read the error you were given? super() takes an argument, and
you're not giving it any. Go read the documentation for super.
http://docs.python.org/library/functions.html#super
Hugo
More information about the Tutor
mailing list