[Baypiggies] Question on Python's MRO...
Guido van Rossum
guido at python.org
Wed Jan 4 12:37:17 EST 2017
C's MRO is (C, A, B, object), and method lookup happens in that order. So
if both A and B define a method m, but C doesn't, A.m gets used.
For old-style classes the lookup order would still be (C, A, B).
Maybe you can clarify *what* is happening from right to left in your
understanding? Code speaks!
On Wed, Jan 4, 2017 at 9:30 AM, Braun Brelin <bbrelin at gmail.com> wrote:
> Hi all,
> I'm trying to figure out how to understand Python's Method Resolution
> One of the things that's really confusing me is that from my understanding
> if I have a class declaration like this
> class C(A,B):
> Python does the inheritance order from right to left, yet all the
> tutorials on MRO
> start talking about inheritance from left to right.
> Is the right to left order a property of the older Python 2 style classes
> that didn't
> explicitly inherit from object?
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Baypiggies