Supposed I am given a variable pointing to a method of a class, is it possible to retrieve the variable pointing to its class?
For example, I have the following class,
class AClass(object):
def __init__(self):
pass
@classmethod
def class_method(cls):
return None
def instance_method(self):
return None
@staticmethod
def static_method():
return None
say, I am given only AClass.instance_method
variable, is it possible to get Aclass
based on that?
such that I could define a function with the following outcome.
def get_its_class(AClass.method):
....
return AClass
And I hope such a function can work for class methods, static methods, and (instance) methods?