<div dir="ltr"><div>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.<br><br></div>For old-style classes the lookup order would still be (C, A, B).<br><br>Maybe you can clarify *what* is happening from right to left in your understanding? Code speaks!<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 4, 2017 at 9:30 AM, Braun Brelin <span dir="ltr"><<a href="mailto:bbrelin@gmail.com" target="_blank">bbrelin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all, <div><br></div><div>I'm trying to figure out how to understand Python's Method Resolution order.</div><div>One of the things that's really confusing me is that from my understanding</div><div>if I have a class declaration like this</div><div><br></div><div>class C(A,B):</div><div>      ...</div><div><br></div><div>Python does the inheritance order from right to left, yet all the tutorials on MRO</div><div>start talking about inheritance from left to right. </div><div><br></div><div>Is the right to left order a property of the older Python 2 style classes that didn't </div><div>explicitly inherit from object?</div><div><br></div><div>Thanks</div><div><br></div><div><br></div></div>
<br>______________________________<wbr>_________________<br>
Baypiggies mailing list<br>
<a href="mailto:Baypiggies@python.org">Baypiggies@python.org</a><br>
To change your subscription options or unsubscribe:<br>
<a href="https://mail.python.org/mailman/listinfo/baypiggies" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/baypiggies</a><br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div>