标签:实现 not pytho let class 模式 div object *args
1 class Singleton(object): 2 def __new__(cls, *args, **kwargs): 3 if not hasattr(cls, ‘_instance‘): 4 cls._instance = super(Singleton, cls).__new__(cls, *args, **kwargs) 5 return cls._instanc
class Singleton(object):
_instance = None def __new__(cls, *args, **kwargs): if not _instance: cls._instance = super(Singleton, cls).__new__(cls, *args, **kwargs) return cls._instanc
标签:实现 not pytho let class 模式 div object *args
原文地址:https://www.cnblogs.com/chenyoude/p/9864512.html