singleton objects with decorators

Steven Bethard steven.bethard at gmail.com
Tue Apr 12 04:01:05 EDT 2005


Uwe Mayer wrote:
> 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.

Ahh, I see.  I would typically just use a module in this situation, 
where the configuration settings were just names global to the module. 
Is there a benefit to using a singleton object over using just a module?

STeVe



More information about the Python-list mailing list