装饰器
装饰器的原理就是闭包,调用方式不变
def test(func):
print('----func----')
def test2():
print('----test2这里是扩展功能----')
func()
return test2
@test
def test1():
print('----test1----')
test1()
执行流程图
原创文章,作者:6024010,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/244266.html