singletons

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Thu Jul 17 01:01:12 EDT 2008


In message
<e2ef1d2c-f39b-43e2-a848-0cb7660fd9fa at l42g2000hsc.googlegroups.com>, Craig
Allen wrote:

> ... the ideal is still that
> 
> tl = TehLibrary() would always return the same object.

>> class TehLibrary(object) :
...     @classmethod
...     def __new__(self, cls) :
...         return self

>>> s = TehLibrary()
>>> s == TehLibrary()
True




More information about the Python-list mailing list