Home | Trees | Indices | Help |
|
---|
|
object --+ | type --+ | Singleton
Singleton metaclass. To make a class instance a singleton, use this class as your class's metaclass as follows: class MyClass(object): __metaclass__ = Singleton Singletons are created by passing the exact same arguments to the constructor. For example: class T(): __metaclass__ = Singleton def __init__(self, value=None): self.value = value t1 = T() t2 = T() t1 is t2 True t3 = T(5) t4 = T(5) t3 is t4 True t1 is t3 False
|
|||
|
|||
|
|||
Inherited from Inherited from |
|
|||
Inherited from Inherited from |
|
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
x(...)
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Sep 7 12:30:33 2010 | http://epydoc.sourceforge.net |