mlpy.modules.patterns.Singleton¶
-
class
mlpy.modules.patterns.Singleton[source]¶ Bases:
typeMetaclass ensuring only one instance of the class exists.
The singleton pattern ensures that a class has only one instance and provides a global point of access to that instance.
See also
Notes
To define a class as a singleton include the
__metaclass__directive.Examples
Define a singleton class:
>>> from mlpy.modules.patterns import Singleton >>> class MyClass(object): >>> __metaclass__ = Singleton
Note
Methods
__call__(*args, **kwargs)Returns instance to object.