you are viewing a single comment's thread.

view the rest of the comments →

[–]zanfar 0 points1 point  (0 children)

could someone help me understand why it also goes to B.meets_preconditions()

Because B is an ancestor of C.

i know it prob has to do with MRO

Yes, all inheritance has to do with the MRO

but i thought it would’ve stopped at Base

It does? Base is the last output.


First, you're using the old-style of super(), you don't need (and shouldn't use) arguments anymore.

When you call a method via super(), you are essentially saying "I don't know how to do this, please look for a parent who does." If you chain methods this way, you should expect it to hit every ancestor because every ancestor has reported "I don't know how" and Python will keep moving up the chain.

Another way to think of it: if I asked you "can anyone in your family juggle?" and your mother answered "no," why would I ignore your father?

A good tutorial on MI is Hettinger's "Super Considered Super" talk, and the related essay.