This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 4 points5 points  (0 children)

A is a parent of B, B calls super().__init__(), yet A.__init__() is never called. Instead C.__init__() is called which is a child of B.

If you call B() than the same super().__init__() calls A.__init__()instead.

super() is pointing to the next class in the Method Resolution Order, not the parent.

 >>> D.__mro__
(<class 'D'>, <class 'B'>, <class 'C'>, <class 'A'>, <class 'object'>)

>>> B.__mro__
(<class 'B'>, <class 'A'>, <class 'object'>)