[Python-ideas] Consider (one day) adding an inheritance order class precedence mechanism
Ethan Furman
ethan at stoneleaf.us
Thu Nov 16 08:58:10 EST 2017
On 11/15/2017 10:10 PM, Greg Ewing wrote:
> Steven D'Aprano wrote:
>> These are not equivalent:
>>
>> B < S, E
>> B < E, S
>
> Not in general, but in many cases they will be, e.g. if
> E and S have no method names in common. I think the OP is
> implying that his case is one of those.
>
> Maybe what's really wanted is a way to say "B inherits from
> S and E, but it doesn't care what order they go in". Then
> the MRO generating algorithm could in principle swap them
> if it would result in a consistent MRO.
>
> Or maybe the MRO generator could decide for itself if the
> order of two base classes can be swapped by inspecting
> their attributes to see if any of them clash?
If they don't have any clashing attributes, why does order matter?
--
~Ethan~
More information about the Python-ideas
mailing list