顾名思义,只能创建一个实例对象
1 2 3 4 5 6 7 |
class Singleton(object): __instance = None def __new__(cls, XX, YY): if not cls.__instance: cls.__instance = object.__new__(cls) return cls.__instance |
顾名思义,只能创建一个实例对象
1 2 3 4 5 6 7 |
class Singleton(object): __instance = None def __new__(cls, XX, YY): if not cls.__instance: cls.__instance = object.__new__(cls) return cls.__instance |