Package pypat :: Package creational :: Module singleton :: Class Singleton
[hide private]
[frames] | no frames]

Type Singleton

source code

object --+    
         |    
      type --+
             |
            Singleton


Singleton Metaclass.

Enforces any object using this metaclass to only create a single instance.

- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Creational-Pattern-Usage}
- External Singleton Pattern documentation: U{https://en.wikipedia.org/wiki/Singleton_pattern}

Instance Methods [hide private]
 
__call__(cls, *args, **kwargs)
Override the __call__ method to make sure only one instance is created.
source code

Inherited from type: __delattr__, __eq__, __ge__, __getattribute__, __gt__, __hash__, __init__, __instancecheck__, __le__, __lt__, __ne__, __new__, __repr__, __setattr__, __subclasscheck__, __subclasses__, mro

Inherited from object: __format__, __reduce__, __reduce_ex__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __instance = None
Properties [hide private]

Inherited from type: __abstractmethods__, __base__, __bases__, __basicsize__, __dictoffset__, __flags__, __itemsize__, __mro__, __name__, __weakrefoffset__

Inherited from object: __class__

Method Details [hide private]

__call__(cls, *args, **kwargs)
(Call operator)

source code 

Override the __call__ method to make sure only one instance is created.

Overrides: type.__call__