[Python-Dev] One-line abstractmethod function?

Allen Li cyberdupo56 at gmail.com
Fri Dec 6 03:08:12 CET 2013


On Thu, Dec 05, 2013 at 01:33:00PM -0800, Guido van Rossum wrote:
> > The only two alternatives are doing nothing/pass/return
> > None or having actual code in the method.
> >
> > The former is only useful to silently ignore blind super() calling, the
> > latter you would define and decorate the method normally.
> 
> Actually if you want to support multiple inheritance of your ABC, your
> abstract methods *must* be no-ops (or have some kind of default
> behavior that can always be done last).

I must respectfully disagree with this.  If your ABCs aren't meant to be
in the MRO, then you should be @registering them as virtual classes and
not inheriting them.

The trick with Python multiple inheritance and super() (from personal
experience) is to not think of it as multiple inheritance (a tree with
cycles), but as building the MRO (linear, the same as single
inheritance).


More information about the Python-Dev mailing list