与函数相反,类的主体在定义时执行:
class A(object): print 'hello'
日期:
hello
为什么会这样?它与@classmethod/ @staticmethodmethods和class属性有关吗?
@classmethod
@staticmethod
python class python-2.7 python-internals
class ×1
python ×1
python-2.7 ×1
python-internals ×1