假设以下类定义:
class A:
def f(self):
return 'this is f'
@staticmethod
def g():
return 'this is g'
a = A()
Run Code Online (Sandbox Code Playgroud)
所以f是常规方法,g是静态方法.
现在,我如何检查ffion对象af和ag是否是静态的?Python中有"isstatic"功能吗?
我必须知道这一点,因为我有包含许多不同函数(方法)对象的列表,并且要调用它们我必须知道它们是否期望"自我"作为参数.