【发布时间】:2010-09-23 06:50:20
【问题描述】:
我有一个将另一个函数作为参数的函数。如果函数是类的成员,我需要找到该类的名称。例如
def analyser(testFunc):
print testFunc.__name__, 'belongs to the class, ...
我以为
testFunc.__class__
会解决我的问题,但这只是告诉我 testFunc 是一个函数。
【问题讨论】:
标签: python reflection metaprogramming