import abc | |
class Singleton(abc.ABC): | |
_instances = {} | |
def __new__(cls, *args, **kwargs): | |
if cls not in cls._instances: | |
cls._instances[cls] = super(Singleton, cls).__new__(cls) | |
return cls._instances[cls] | |
import abc | |
class Singleton(abc.ABC): | |
_instances = {} | |
def __new__(cls, *args, **kwargs): | |
if cls not in cls._instances: | |
cls._instances[cls] = super(Singleton, cls).__new__(cls) | |
return cls._instances[cls] | |