multiple inheritance of a dynamic list of classes?

Peter Otten __peter__ at web.de
Wed Feb 14 12:56:33 EST 2007


Neil Cerutti wrote:

> On 2007-02-13, Peter Otten <__peter__ at web.de> wrote:
>> Well, what problems ocurring with
>>
>> class A: pass
>> class B: pass
>> class C(A, B): pass
>>
>> could be avoided by writing
>>
>> class A: pass
>> class B(A): pass
>> class C(B): pass
>>
>> instead?
> 
> With multiple inheritance, the choice of algorithm for Method
> Resolution Ordering isn't obvious or trivial. As I understand it,
> Python got it wrong for quite some time, allowing "bad"
> hierarchies to compile, i.e., classes for which the properties of
> local precedence ordering and monotonicity did not hold.
> 
> URL:http://www.python.org/download/releases/2.3/mro/

Is it correct that as long as no classes occur twice in the hierarchy no
such ambiguities can arise?

Peter



More information about the Python-list mailing list