class Foo(object):
def test(self):#定义了实例方法
print("object")
@classmethod
def test2(cls):#定义了类方法
print("class")
@staticmethod
def test3():#定义了静态方法
print("static")
ff = Foo()
ff.test()
Foo.test(ff)
ff.test2()
Foo.test2()
ff.test3()
Foo.test3()
总结:
实例方法、类方法和静态方法都可以有类或实例来调用