[Python-ideas] MRO local precedence ordering revisited

Stephan Sahm Stephan.Sahm at gmx.de
Thu Dec 10 15:51:31 EST 2015


@Chris
thanks for pointing out this self-reference, I am still not sure whether
this is really suprising to me, but at least I am still not done with
thinking about it, so probably it is

@Ned
As I understood it, the MRO is not only for searching attributes - there it
is indeed impressively redundant to put the same class twice into the MRO,
thanks for pointing that out - but also for the hierarchy of the super()
command

@all
thank you all for your comments and help. My current conclusion is that I
will read about the C3 algorithm in crucially more detail and what it in
fact is trying to solve ... and eventually may come back

best,
Stephan

On 10 December 2015 at 21:43, Ned Batchelder <ned at nedbatchelder.com> wrote:

> On 12/10/15 3:03 PM, Stephan Sahm wrote:
>
> (B, mixin, A, mixin, object)
>
> or in the simpler, more trivial version
>
> (B, object, A, object)
>
> As you haven't mentioned this as a possibility at all, I guess having a
> class twice in this list produces some weird behaviour I do not know about
> yet - if someone can point out, that would be great.
>
> The MRO is a list of classes to search for attributes.  There's no point
> in having a class listed twice.  The second occurrence would never be used,
> because any attribute it could provide would be found on the first
> occurrence of the class.
>
> --Ned.
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151210/aca5886b/attachment.html>


More information about the Python-ideas mailing list