Given a method handle in Python 3, how do I retrieve the object it is part of?
class Myclass:
def foo(self):
print(self, 'foo')
m = Myclass()
method_handle = m.foo
print(method_handle) # -> <bound method Myclass.foo of <__main__.Myclass object at 0x7fb80220dd10>>
The method_handle
object has a reference to the m
instance somewhere. But if I only have the method_handle
, how do I retrieve the m
object?