pass arguments for singleton creation.
This commit is contained in:
parent
fe9af95b52
commit
db48e94fb6
1 changed files with 2 additions and 2 deletions
|
@ -9,10 +9,10 @@ def singleton(cls):
|
|||
"""
|
||||
instances = {}
|
||||
|
||||
def getinstance():
|
||||
def getinstance(*args, **kwargs):
|
||||
""" return existing instance of new
|
||||
"""
|
||||
if cls not in instances:
|
||||
instances[cls] = cls()
|
||||
instances[cls] = cls(*args, **kwargs)
|
||||
return instances[cls]
|
||||
return getinstance
|
||||
|
|
Reference in a new issue