感觉没有啥要说的,相信大家都可以看懂,直接上代码
def out_func(level):
def mid_func(func):
def inner_func(*args, **kwargs):
print("i'm number one execute")
print(level)
func(level, *args, **kwargs)
print("i'm number three execute")
return inner_func
return mid_func
@out_func(level=123)
def speak(a):
print(a)
if __name__ == '__main__':
speak()