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

 

posted @ 2016-08-25 17:38  萱娃  阅读(188)  评论(0编辑  收藏  举报