[Tutor] super.__init__() arguments

Lie Ryan lie.1296 at gmail.com
Mon Sep 27 09:11:55 CEST 2010


On 09/27/10 09:45, Jojo Mwebaze wrote:
> Hey Tutor,
> 
> Seems a small issue but this has been playing for a while now, what am i
> doing wrong here?
> 

super() without argument only works for Python 3. In Python 2.x, you
have to pass to super your class name and your class instance, i.e.:

Class Circle(Point):
    def __init__(self, radius=0, x=0, y=0):
        super(Point, self).__init__(x, y)
        self.radius = radius



More information about the Tutor mailing list