Is there way to determine which class a method is bound to?
Richie Hindle
richie at entrian.com
Fri Feb 25 09:54:34 EST 2005
[vic]
> I'm doing some evil things in Python and I would find it useful to
> determine which class a method is bound to when I'm given a method
> pointer.
Here you go:
>>> class Foo:
... def bar(self):
... pass
...
>>> Foo.bar.im_class
<class __main__.Foo at 0x008ED720>
>>> Foo().bar.im_class
<class __main__.Foo at 0x008ED720>
>>>
--
Richie Hindle
richie at entrian.com
More information about the Python-list
mailing list