In article <[EMAIL PROTECTED]>, Victor Ng <[EMAIL PROTECTED]> wrote: >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.
I don't know where (or if) it's documented, but im_class seems to give you what you want. ------ class Foo(object): def x(self): return 42 f = Foo() print f.x.im_class ------ king:play$ ./x.py <class '__main__.Foo'> I have no idea why it's not __imclass__ or some such, but poking around with dir() is a great way to explore little nooks and crannies like this. I just printed dir(Foo().x) and tried stuff that looked interesting until I found what I (you) wanted. -- http://mail.python.org/mailman/listinfo/python-list