Use case for multiple inheritance (was Re: MRO problems with diamond inheritance?)

Aahz aahz at pythoncraft.com
Mon May 2 13:44:03 EDT 2005


In article <1115025031.721431.76320 at o13g2000cwo.googlegroups.com>,
Michele Simionato <michele.simionato at gmail.com> wrote:
>
>BTW, what it your use case? I have yet to see a single compelling use
>case for multiple inheritance, so I am curious of what your design is.

Dunno whether you'd call it compelling, but my current company uses
multiple inheritance to compose a mega-class with different methods
depending on what the mega-class's capabilities are.  It's a pretty
baroque design, admittedly, but I'm not sure how I'd do it differently
from scratch.  We've even implemented our own super() for cooperative
method calls with classic classes.

(This application was started in Python 1.4; we're slowly refactoring
it, but we're still using Python 2.2/2.3 -- we didn't get rid of 1.5.2
until last July.  Now you know why I've gotten even more conservative
since I started this job last June...)
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"It's 106 miles to Chicago.  We have a full tank of gas, a half-pack of
cigarettes, it's dark, and we're wearing sunglasses."  "Hit it."



More information about the Python-list mailing list