On Tue, Apr 12, 2022 at 11:17:27AM -0000, malmiteria  wrote:
> Steven D'Aprano writes:
> 
> > So in the general case, order matters. We have to linearize the 
> > superclasses, and call them in that linear order, and the best way to do 
> > that is with the MRO and super.

> Why would we *have* to do that?

Because if you don't, you aren't doing multiple inheritence.

If you don't want MI, if you want delegation or composition, then of 
course you can do something else. But if you want MI in its full 
generality, that's really the only thing you can do.


> When multiple parent provide candidate to a method resolution, raise an error.

Then you aren't doing full MI any more, just a limited, restricted 
version known as traits.


> The child class now has to redefine the method, and in the body of that 
> method, can decide which parent method call, or in what order call them.
> That's essentially the basic idea of my proposal.
> What makes this impossible for you?

Its not impossible, I have been telling you about traits since my 
earliest posts in this thread.

Maybe you need to stop thinking you have invented some brilliant idea 
which has solved a problem nobody else has noticed, and read some of the 
Artima links I have days ago.


> I think i've adressed most if not all problems i had raised against it.

Except the most important one: why are you using multiple inheritence 
when you clearly don't want multiple inheritence, instead you want 
delegation?


> Linearisation is litterally an operation that consist into converting 
> a multiple inheritance tree into a simple inheritance tree.

That is absolutely not what linearization does.

> That's bound to lose some info, 

No, the point of linearization is to avoid losing info.


> and can't cover all cases.

Correct, there are inconsistent inheritence hierarchy which are 
impossible to linearise because they are inconsistent. It is better to 
get an error when you try to define the inconsistent hierarchy, rather 
than pretend it is consistent and then wonder why inheritence is not 
working and methods are called in inconsistent order.


-- 
Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/A3V2OYAD4USX64BAL7JMRDIFYUM2KLWD/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to