MRO B, A, AA, Base. , super(A, self), self B, AA. A, super Base.
, , .
A super(A,self).__init__() Base.__init__(self), B AA.__init__(self)
, :
No, you cannot find a class allowed by super for the simple reason that different attributes can be allowed for different classes.
For example, in the code, enter a class AAmethod foo. Now:
b = B()
super(B,b).__init__()
super(B,b).foo()
The function superdoes not just find the next class in the MRO chain, it finds the next class that has the desired attribute. This is why it should return a proxy object, and not just return a class.
source
share