类方法,静态方法,普通方法
#coding=utf-8
class Foo:
def __init__(self,name):
self.name=name
def ord_func(self):
print self.name
print "normal function"
@classmethod
def class_func(cls):
print "class method"
@staticmethod
def static_func():
print "static method"
f=Foo('xiaxiaoxu')
f.ord_func()
Foo.class_func()
Foo.static_func()
c:Python27Scripts>python task_test.py
xiaxiaoxu
normal function
class method
static method