singleton objects with decorators

Uwe Mayer merkosh at hadiko.de
Tue Apr 12 03:16:43 EDT 2005


Tuesday 12 April 2005 06:36 am Steven Bethard wrote:
> Uwe Mayer wrote:
>> I've been looking into ways of creating singleton objects.
> 
> It strikes me that I've never wanted or needed a singleton object.
> Would you mind sharing your use case?  I'm just curious.

I am using a class to manage configuration settings in an application. This
object should only existe once so that when the user
changes a setting through a configuration dialog the change imminent in all
locations where access to config settings are needed.

I was using a factory function bevore, but since I am starting to use Python
2.4 and I remembered having read about a singleton-decorator I went to look
deeper into the possibilities.

Ciao
Uwe     



More information about the Python-list mailing list