super() without arguments: How Python finds self and the MRO

super() without arguments: How Python finds self and the MRO

In Python, invoke super as:

super().__init__(x)

Where’s self? Or the MRO?

– At compile time, Python adds a __class__ closure cell.
– At runtime, super() grabs self from the calling frame — and walks type(self).__mro__ from __class__.

No arguments needed (unlike Python 2)!