def set_func(func): def call_func(): print(‘....权限1.....‘) print(‘....权限2.....‘) func() return call_func @set_func # 等价于 test1 = set_func(test1) def test1(): print(".......这是test1......") test1()
第二十六节 对没有返回值没有参数的函数进行装饰
原文:https://www.cnblogs.com/kogmaw/p/12602550.html