Hi
Inspired by "Modifying the default argument of function"
https://groups.google.com/forum/#!topic/comp.lang.python/1xtFE6uScaI
is it possible to create singleton using construct below :
def singleton_provider(x = [None]):
if singleton_provider.__defaults__[0][0] == None:
singleton_provider.__defaults__[0][0] = SomeClass()
return singleton_provider.__defaults__[0][0]
and question - how to make it work in multithreaded app
when multiple threads are racing to create it first?
Thanks
Asaf
--
https://mail.python.org/mailman/listinfo/python-list