an example of a singleton design pattern in python?
Ville Vainio
ville.spamstermeister.vainio at thisisspamprotectiontut.finland
Tue Jan 20 16:26:06 EST 2004
>>>>> "Daniel" == Daniel Ortmann <dortmann at lsil.com> writes:
Daniel> Hello, Does anyone have an example of a singleton design
Daniel> pattern in python?
This trivial snippet might be enough for your needs:
class Foo():
pass
_inst = None
def fooinstance():
if not _inst:
_inst = Foo()
return _inst
--
Ville Vainio http://tinyurl.com/2prnb
More information about the Python-list
mailing list