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
‹
›
Home
View web version
No comments:
Post a Comment