When defining methods in a class we do have an argument for the object on which the method is invoked i.e self.
Say I have a class Foo.
class Foo: def m(self): pass
now when we have an object of Foo, say foo.
and we do something like this,
foo_m = foo.m
and then try calling foo_m with the same parameters the way would have done with foo.m. It just works.
So How does foo_m knows what should be the value of the self argument when it is not being called in
foo.m() fashion ?
on printing the foo.m, the REPL shows that its a bound method to that particular object.
Is it some other function object that keeps track of the self argument and the method to be called ?