Home | Trees | Indices | Help |
|
---|
|
object --+ | dict --+ | Singleton
>>> a=Singleton() >>> a.x=1 >>> b=Singleton() # same singleton as a >>> print b.x 1 >>> class C(Singleton): pass >>> c=C() # new singleton >>> c.y=2 >>> d=C() # same singleton as c >>> print d.x, d.y None 2 >>> d.set_state({}) # state can be reset >>> print d.x, d.y None None
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from |
|
|||
thread = threading.local()
|
|
|||
Inherited from |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Mon Apr 25 15:04:07 2011 | http://epydoc.sourceforge.net |