Getting the class of a method in Python 2.2 (semantic change from 2.1)
Kali Kim
kalipygian at hotmail.com
Tue Nov 20 19:32:54 EST 2001
class A:
def aaa(self):
pass
class B(A):
def bbb(self):
pass
def whosemethod(method):
return method.im_class.__name__
With Python 2.1,
>>> whosemethod(B.bbb)
'B'
>>> whosemethod(B.aaa)
'A'
But with Python 2.2,
>>> whosemethod(B.bbb)
'B'
>>> whosemethod(B.aaa)
'B'
I want to know where B.aaa is getting inherited from, but can't find a
*easy and obvious* (tm) way with Python 2.2.
Can anyone help me?
More information about the Python-list
mailing list