MyWeChatQrcode / common /singleton.py
xiaochuan163@126.com
all
ebf0e28
Raw History Blame Contribute Delete
217 Bytes
def singleton(cls):
instances = {}
def get_instance(*args, **kwargs):
if cls not in instances:
instances[cls] = cls(*args, **kwargs)
return instances[cls]
return get_instance