1
0
Fork 0
mirror of synced 2024-05-29 21:41:11 -04:00
dotbot/dotbot/util/singleton.py
2014-03-20 18:57:56 -04:00

7 lines
238 B
Python

class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
return cls._instances[cls]