success
This commit is contained in:
8
annotations/singleton.py
Executable file
8
annotations/singleton.py
Executable file
@@ -0,0 +1,8 @@
|
||||
|
||||
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
|
Reference in New Issue
Block a user