装饰器 -- 单例模式

def decorator(func):
    def wrapper_decorator(*args, **kwargs):
        #调用前操作
        ret_val = func(*args, **kwargs)
        #调用后操作
        return ret_val
    return wrapper_decorator

转载:https://mp.weixin.qq.com/s/hl2O3tmc35IhwfvP0vxqiQ

posted @ 2022-07-29 10:16  二二二狗子  阅读(24)  评论(0)    收藏  举报