[Tutor] super.__init__() arguments

Wayne Werner waynejwerner at gmail.com
Mon Sep 27 13:01:06 CEST 2010


In addition it only works for new style classes.

-wayne

On 9/27/10, Lie Ryan <lie.1296 at gmail.com> wrote:
> 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
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>

-- 
Sent from my mobile device


More information about the Tutor mailing list