def test(func):
func()
print "call test"
def test1(f):
f()
print "call test1"
def main():
@test
def fun():
print "call fun"
@test1
def fun1():
print "call fun1"
main()
输入如上
输出如下
call fun
call fun1
call test1
call test
引用知乎链接:https://www.zhihu.com/question/26930016
引用CSDN链接:http://blog.csdn.net/972301/article/details/59537712