[Python-Dev] Problems with the new super()

Greg Ewing greg.ewing at canterbury.ac.nz
Fri May 2 04:21:28 CEST 2008


Gustavo Carneiro wrote:

> A better question would be, is multiple inheritance good or bad for
> programs? :-)

I would say there are good ways of using it, and bad
ways of using it.

In my experience, the good ways occur when the classes
being mixed together are completely independent -- there
is no overlap in method or instance variable names, and
each class brings its own independent bundle of
functionality to the party.

If the classes being mixed clash or overlap in functionality
somehow, the inheriting class needs to override all of the
clashing methods and properties and resolve matters by
delegating to one or another of the inherited classes
(using explicit inherited method calls, not super!).

If it's not feasible to do that for some reason, then
you're better off forgetting about multiple inheritance
and finding some other solution to the problem.

-- 
Greg


More information about the Python-Dev mailing list