Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?
michele.simionato at gmail.com
Mon Aug 2 08:15:11 CEST 2010
On Jul 31, 5:08 am, Steven D'Aprano <st... at REMOVE-THIS-
> I have read Michelle Simionato's articles on super in Python.
One "l" please! I am a man! ;-)
> But Michelle is wrong to conclude that the problem lies with the concept
> of *superclass*. The problem lies with the idea that there is ONE
> superclass. By dismissing the entire concept, he is throwing out the baby
> with the bathwater.
I am actually more radical than that. From
In this series I have argued that super is tricky; I think nobody can
dispute that. However the existence of dark corners is not a
compelling argument against a language construct: after all, they are
rare and there is an easy solution to their obscurity, i.e.
documenting them. This is what I have being doing all along. On the
other hand, one may wonder if all super warts aren't hints of some
serious problem underlying. It may well be that the problem is not
with super, nor with cooperative methods: the problem may be with
multiple inheritance itself.
Then I spend thousands of words in the "Mixin considered harmful"
series and in other articles arguing against
multiple inheritance and cooperative methods. They are just bad design
IMO. Of course we are in the range of opinions, this is a tricky
subject: many smart people agree with me and many others equally smart
Still I believe that super is a red herring and that you should really
start thinking: what advantages did
multiple inheritance *really* bring into my code? Could have I done
without? And what would have happen?
These are the relevant question, not the exact meaning of super in
More information about the Python-list