摘要: from abc import ABCMeta, abstractmethod import time ''' 别名:监听模式、观察者模式、推拉模型、订阅模式(一对多) 被观察者的三个方法:添加观察者、移出观察者、通知观察者 观察者的一个方法:更新方法 每当被观察者的状态发生改变时,就会通知观察者, 阅读全文
posted @ 2020-05-24 23:57 找回失去的自我 阅读(380) 评论(0) 推荐(0)
摘要: # 单例模式 class Singleton(object): __instance = None __isFirstInit = True # 理解__new__是创建对象的 def __new__(cls, *args, **kwargs): # if not cls.__instance: # 阅读全文
posted @ 2020-05-24 00:25 找回失去的自我 阅读(116) 评论(0) 推荐(0)