Consider the following example:
class Base:
def b(self):
pass
class Derived(Base):
def b(self):
super().b()
def d(self):
pass
Derived.b.__closure__
Out[4]: (<cell at 0x7f9664103610: type object at 0x7f965dd8c2b0>,)
Derived.d.__closure__
Derived.b.__closure__[0].cell_contents
Out[6]: __main__.Derived
I wish to understand the following:
- Why does Derived.b contains a closure and Derived.d not
- What happening behind the scenes? explanation of Derived.b cell_contents result
- Is using the cell_contents result is a possible way to detect that a method called super() ?
Thanks!