[Python-Dev] PEP 560: bases classes / confusion
Ethan Furman
ethan at stoneleaf.us
Thu Nov 16 12:58:59 EST 2017
On 11/16/2017 04:22 AM, Ivan Levkivskyi wrote:
> On 16 November 2017 at 07:56, Nick Coghlan wrote:
>> Jim also raised an important point that needs clarification at the spec
>> level: given multiple entries in "orig_bases" with __mro_entries__ methods,
>> do all such methods get passed the *same* orig_bases tuple? Or do they
>> receive partially resolved ones, such that bases listed before them have
>> already been resolved to their MRO entries by the time they run.
>
> Yes, they all get the same initial bases tuple as an argument. Passing
> updated ones will cost a bit more and I don't think it will be needed
> (in the worst case a base can resolve another base by calling its
> __mro_entries__ manually). I will clarify this in the PEP.
If the extra complexity is to:
> - given orig_bases, a method could avoid injecting bases already listed
> if it wanted to
> - allowing multiple items to be returned provides a way to programmatically
> combine mixins without having to define a new subclass for each combination
And each method is passed the same original tuple (without other methods' updates) then don't we end up in a situation
where we can have duplicates base classes?
--
~Ethan~
More information about the Python-Dev
mailing list