您的位置:首页 > 其它

多个装饰器的执行顺序

2017-06-09 16:29 246 查看
def first(func):
def inner():
print("this is firt!")
func()
return inner

def second(func):
def inner():
print("this is second!")
func()
return inner

def third(func):
def inner():
print("this is third!")
func()
return inner

@second
@first
@third
def myfun():
print("this is my fun()!")

myfun()


输出

this is second!

this is firt!

this is third!

this is my fun()!

无需解释
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: