I have a singleton like this
class Singleton:
class __impl:
def __init__(self):
print \"INIT\"
__instance = None
def __ini
PEP 318 has an example of a singleton decorator for classes:
def singleton(cls):
instances = {}
def getinstance():
if cls not in instances:
instances[cls] = cls()
return instances[cls]
return getinstance
@singleton
class MyClass:
...
(though I haven't used it myself.)
Btw, about...
I made a singleton like this
Also, you should mention that you copied it directly from ActiveState.