[python] Singleton pattern

This is what I found from internet, when you need singleton object in global.

class Singleton(object):

_singletons = { }

def __new__(cls, *args, **kwds):

if not cls._singletons.has_key(cls):

cls._singletons[cls] = object.__new__(cls)

[...]