[Python-Dev] New Super PEP

"Martin v. Löwis" martin at v.loewis.de
Sun Apr 29 14:53:57 CEST 2007


>     Since calling super with any
>     arguments other than the exact same arguments you have received is
>     nearly always wrong,
> 
> 
>   Erm.  Excuse me, but are you saying this code is wrong?
> 
> class Rectangle:
>     def __init__(self, width, height):
>         self.width = width
>         self.height = height
> 
> class Square:
>     def __init__(self, side):
>         Rectangle.__init__(self, side, side)

That's not what he said. Your code does not call super(), so the
observation that it normally should pass the exact same arguments
does not apply.

Regards,
Martin


More information about the Python-Dev mailing list