Python 修饰符

def hello(fn):
    def wrapper():
        print "hello"
        fn()
        print "goodby"
    return wrapper
@hello #@注解语法糖

# @作用:解释器会解释成下面这样的语句:

#test()等价于test=hello(test)
def test():
    pass
test()

http://www.cnblogs.com/rhcad/archive/2011/12/21/2295507.html

http://blog.csdn.net/my2010sam/article/details/8585336

http://www.au92.com/archives/when-to-use-staticmethod-classmethod-in-pthon.html

上一篇:【转载】 python修饰符@


下一篇:C语言中的回调函数(Callback Function)