"Super()" confusion

Jean-Paul Calderone exarkun at divmod.com
Tue Feb 10 14:45:23 EST 2009


On Tue, 10 Feb 2009 19:40:56 +0000 (UTC), Benjamin Peterson <benjamin at python.org> wrote:
>Marc 'BlackJack' Rintsch <bj_666 <at> gmx.net> writes:
>
>>
>> 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.
>
>super() is great for single inheritance because it furthers the DRY principle
>(base classes are not scattered through the code), and rather ugly use of
>unbound methods.

It replaces one kind of repetition with another.  I think each kind is
about as unpleasant.  Has anyone gathered any data on the frequency of
changes of base classes as compared to the frequency of classes being
renamed?  I don't think either happens very often, but it might be
interesting to see some numbers.

Jean-Paul



More information about the Python-list mailing list