On Tue, 29 Mar 2022 at 04:24, malmiteria <martin.mi...@ensc.fr> wrote:
> Essentially, when two parent class provide a method with the same name, 
> that's what i call a conflict.
>

You keep saying this, but I'm still confused: how is that different
from the very normal behaviour of overriding a method? What makes one
of them a critical feature of inheritance, and the other a conflict
that has to be resolved?

How do you distinguish conflicts from overrides?

My best understanding so far is that you're doing something like:

class Pizza(Crust, Topping): ...

and then you could have a conflict like this:

class StuffedCrust(Crust):
    def add_cheese(self): ...

class ThreeCheeseTopping(Topping):
    def add_cheese(self): ...

which would result in an error when you try to build this pizza:

class AllTheCheese(StuffedCrust, ThreeCheeseTopping): ...

But the problem with this example is that it's using Crust and Topping
as superclasses when they're really not. This would be MUCH better
served by something like:

class Pizza:
    def __init__(self, Crust, Topping):
        self.crust = Crust()
        self.topping = Topping()

And now you don't have a conflict.

Please, if this is NOT what you're talking about, can you show us an
actual example? Far too many toy examples that don't explain the
problem, no realistic (or at least semi-realistic) examples that
explain the underlying intention.

ChrisA
_______________________________________________
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/T3A7PP24B2RVKKGVRZO7E4RX23FN6DWI/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to