Simon Forman wrote:

> In this case the object's (instance of D) mro will be (D, B, C, A,
> object), so as super gets called in each class, it looks in that list
> (tuple, whatever) for the class following it (actually the next class
> following it that implements the method).
> 
> Since no class appears in that list more than once, each class's
> implementation of the method will only be called once.

But after super(D, self).met() is called, doesn't that then call both 
super(B, self).met() and super(C, self).met()? If so, how does that 
avoid calling A.met twice? Or is that not what's happening?

Here's what I think gets called, in order, after running D().met():

print 'D.met'
super(D, self).met()
print 'B.met'
super(B, self).met()
print 'A.met'
print 'C.met'
super(C, self).met()
print 'A.met'
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to