Redsuncube
create a singleton object in python
class Singleton(object):
def __new__(cls,*args,**kwargs):
if not hasattr(cls,'_inst'):
cls._inst = super(Singleton,cls).__new__(cls,*args,**kwargs)
return cls._inst
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment