<分区> 分区>
class One:
i = One.get(9)
@staticmethod
def get(val):
pass
我尝试使用静态方法初始化静态变量,但上面的代码引发了这个错误:
NameError: name 'One' is not defined
如何在 Python 中使用静态方法初始化静态变量?
<分区> 分区>
class One:
i = One.get(9)
@staticmethod
def get(val):
pass
我尝试使用静态方法初始化静态变量,但上面的代码引发了这个错误:
NameError: name 'One' is not defined
如何在 Python 中使用静态方法初始化静态变量?