第二十六节 对没有返回值没有参数的函数进行装饰

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() 

 

posted @ 2020-03-31 00:52  kog_maw  阅读(130)  评论(0编辑  收藏  举报