我知道有这样的情况是有原因的,但不知何故我有它:
class foo
#static method
@staticmethod
def test():
pass
# class variable
c = {'name' : <i want to reference test method here.>}
有什么办法呢?
仅供记录:
我相信这应该被视为 python 最糟糕的做法。使用静态方法并不是真正的Python方式,如果有的话......
class Foo:
# static method
@staticmethod
def test():
pass
# class variable
c = {'name' : test }
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)