Posted By

sukantahazra on 02/26/10


Tagged

python Singleton designpattern


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

magna
saman


python Singleton


 / Published in: Python
 

  1. class Singleton(object):
  2. def __new__(cls, *p, **k):
  3. if not '_the_instance' in cls.__dict__:
  4. cls._the_instance = object.__new__(cls)
  5. return cls._the_instance

Report this snippet  

You need to login to post a comment.