"Super()" confusion

Michele Simionato michele.simionato at gmail.com
Tue Feb 10 11:11:10 CET 2009


On Feb 10, 10:42 am, Marc 'BlackJack' Rintsch <bj_... at gmx.net> wrote:
> On Tue, 10 Feb 2009 02:02:43 +0000, Benjamin Peterson wrote:
> > Jean-Paul Calderone <exarkun <at> divmod.com> writes:
> >> Consider whether you really need to use super().
>
> >>http://fuhm.net/super-harmful/
>
> > This article chiefly deals with super()'s harm in multiple inteheritance
> > situations. For the simple case, though, like that presented by the OP,
> > I believe super() is perfect.
>
> But for the simple cases it is unnecessary because it was invented to
> deal with multiple inheritance problems.
>
> Ciao,
>         Marc 'BlackJack' Rintsch

Unfortunately there is no good solution. If you have a single
inheritance hierarchy and you do
not use super, you make it impossible for users of your hierarchy to
subclass it by using multiple inheritance in a cooperative way (this
is not polite).
OTOH, if you user super, your users must know about it, to avoid
unexpected cooperation. It is all explained in the "super harmful"
paper, which is a must read even if you only use single inheritance.



More information about the Python-list mailing list