classparent():def__init__(self): self.f()# Boomdeff(self):returnclasschild(parent):def__init__(self): self.f ="not a method"super().__init__()child()# Boom (see above)
I intended that self.f() in parent class would call the parent function but it first resolved to child attribute and produced and error:
Traceback (most recent call last):
File "module.py", line 17, in <module>
child()
File "module.py", line 14, in __init__
super().__init__("tib")
File "module.py", line 6, in __init__
self.f()
TypeError: 'str' object is not callable
It's not that strange when you think about it (to get the most "specialized" or "downward" method/attribute) but how do you restrict to the parent class scope with just no method resolution?