On May 1, 2008, at 9:21 PM, Greg Ewing wrote:

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!).

Sorry but thats just not fair. It's not about convenience for the classes you're inheriting from, its so the inheriting class and superclasses can cooperate without requiring implementation details of one another. I agree that if your methods are 'clashing' then you are probably misinheriting, but cooperative methods can be the most natural way to model certain situations. Not to be dull but when building up a method from smaller reusable bits of functionality this is the case. Once you have explicitly stated the classes you want to inherit from, it isn't magic to expect some of their methods to chain without explicitly restating how exactly they should do that. In fact, doing so may make you more likely to make an error when you change which bits you want to include. If the method resolution order is there (and explicit somewhere) you might as well make use of it.

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.

Is it an issue of feasibility, or of what is the 'most obvious' solution?

jared
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to