[Baypiggies] Question on Python's MRO...

Braun Brelin bbrelin at gmail.com
Wed Jan 4 14:52:39 EST 2017

Hmmm...This is interesting.  I've read a number of web sites that indicate
that the class hierarchy in Python is right to left, not left to right.  Is
this a common mis-perception?


On Wed, Jan 4, 2017 at 9:47 PM, Ryan Hiebert <ryan at ryanhiebert.com> wrote:

> > On Jan 4, 2017, at 1:33 PM, Braun Brelin <bbrelin at gmail.com> wrote:
> >
> > The point here is 'which' foo is being called.  Since it seems to go
> from right to left, it finds mixin2's foo method first, and then when it
> finds mixin1's foo method second that becomes the one that is used...
> >
> > At least that's what seems to be happening.
> Ah, I think I see your confusion. It's not the _last_ one in the MRO that
> get's called, it's the _first_. The highest root (object) will always be
> last in the MRO, and type of the current object will be first.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20170104/d396d0d4/attachment-0001.html>

More information about the Baypiggies mailing list