摘要:
Python中3种方式定义类方法, 常规方式, @classmethod修饰方式, @staticmethod修饰方式. class A(object): def foo(self, x): print("executing foo(%s,%s)" % (self, x)) print('self: 阅读全文
摘要:
Python 除了拥有实例方法外,还拥有静态方法和类方法。 [python] view plain copy class Foo(object): def test(self)://定义了实例方法 print("object") @classmethod def test2(clss)://定义了类 阅读全文