find class where method was defined ?
James Stroud
jstroud at mbi.ucla.edu
Tue Sep 19 19:33:26 EDT 2006
Simon Burton wrote:
>>>>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.
>
b.__class__
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
More information about the Python-list
mailing list