摘要: class Singleton(object): def __new__(cls): # 关键在于这,每一次实例化的时候,我们都只会返回这同一个instance对象 if not hasattr(cls, 'instance'): cls.instance = super(Singleton, cl 阅读全文
posted @ 2020-05-16 15:45 小鱼biubiu 阅读(473) 评论(0) 推荐(0) 编辑