On Apr 1, 4:41 am, Ed Leafe <[EMAIL PROTECTED]> wrote: > I disagree - super is quite elegant and dependable. > > Because Python support multiple inheritance, it is difficult to > manually ensure that when augmenting a method that the correct > superclass calls are made. super() handles that without having to > guess as to what the correct inheritance hierarchy is. > > In my own project (Dabo), we use mixin classes liberally to provide > consistent behavior across our UI classes. The use of super makes > customizing __init__() behavior, for example, quite straightforward. > The general form looks like: > > class DaboUIClass(dabo.ui.dControlMixin, someWxPythonClass): > def __init__(self, *args, **kwargs): > doOurCustomStuffBeforeTheSuperCall() > super(DaboUIClass, self).__init__(*args, **kwargs) > doOurCustomStuffAfterTheSuperCall() > > This has worked reliably for us in every place where we have used it. > There's nothing dark and mysterious about it at all.
It is just that you did not run (yet) in a corner case of super. The interesting question would be: did any of your users run into issues using you library which is heavily relying on super? Especially when composing it with their own classes? I personally have changed my opinion about multiple inheritance over the years. At the beginning I thought it was a very cool idea, but now I think it is a pretty bad idea. If I were to design a language, I would not implement multiple inheritance. In Python I never use multiple inheritance and actually I try very hard to avoid even single inheritance, preferring composition whenever it is viable. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list