class A():
a = 'a'
@staticmethod
def foo1(cls,name):
print('hello', name)
print(A.a) # 正常
cls().foo2(name)
def foo2(self, name):
print('come on', name)
@classmethod
def foo3(cls, name):
print('hello', name)
print(A.a)
cls().foo2(name)
A.foo1(A,'jc')
A.foo3('sss')
输出
hello jc
a
come on jc
None
hello sss
a
come on sss