Package Products :: Package ZenUtils :: Module Utils :: Class Singleton |
[hide private]
[frames] | no frames]

# Type Singleton

source code

    object --+
             |
          type --+
                 |
                Singleton

Metaclass that ensures only a single instance of a class is ever created.

This is accomplished by storing the first instance created as an attribute of the class itself, then checking that attribute for later constructor calls.

Instance Methods | [hide private]
the object's type |
__init__(cls, *args, **kwargs) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code
__call__(cls, *args, **kwargs) x(...) | source code
Inherited from `type`: `__cmp__`, `__delattr__`, `__eq__`, `__ge__`, `__getattribute__`, `__gt__`, `__hash__`, `__le__`, `__lt__`, `__ne__`, `__new__`, `__repr__`, `__setattr__`, `__subclasses__`, `mro`

Properties | [hide private]
Inherited from `type`: `__abstractmethods__`, `__base__`, `__bases__`, `__basicsize__`, `__dictoffset__`, `__flags__`, `__instancecheck__`, `__itemsize__`, `__mro__`, `__name__`, `__subclasscheck__`, `__weakrefoffset__`

Method Details | [hide private]

### __init__(cls, *args, **kwargs) (Constructor) | source code
x.__init__(...) initializes x; see x.__class__.__doc__ for signature Returns: the object's type Overrides: type.__init__ (inherited documentation)

### __call__(cls, *args, **kwargs) (Call operator) | source code
x(...) Overrides: type.__call__ (inherited documentation)