单例模式的装饰器实现
摘要:
def singleton(cls): __instance = {} def wrapper(x): if cls in __instance: return __instance[cls] else: __instance[cls] = cls(x) return __instance[cls] 阅读全文
posted @ 2019-08-08 16:02 lbky 阅读(592) 评论(0) 推荐(0) 编辑