Given the following example, how can we determine at run-time that A.__init__
belongs to class A
?
class A:
def __init__(self):
print(f"We are in class {self.__class__}")
# Prints "We are in class <class '__main__.B'>",
# but desired result is <class '__main__.A'>
class B(A):
def __init__(self):
super().__init__()
B()
Get class that defined method is related, but not the same.