find class where method was defined ?

Simon Burton simon at arrowtheory.com
Tue Sep 19 19:32:38 EDT 2006


>>>
>>> class A(object):
...   def foo(self): pass
...
>>>
>>> class B(A):
...   pass
...
>>>
>>> b=B()
>>> b.foo
<bound method B.foo of <__main__.B object at 0xb7b1924c>>

How can I work out what class b.foo was defined in ?


Simon.




More information about the Python-list mailing list