singletons

Craig Allen callen314 at gmail.com
Fri Jul 18 00:26:34 CEST 2008


On Jul 17, 2:15 am, Uwe Schmitt <rocksportroc... at googlemail.com>
wrote:
> On 17 Jul., 00:20, Craig Allen <callen... at gmail.com> wrote:
>
>
>
> > I have several classes in our system which need to act like
> > singletons, they are libraries of data classifications, and other such
> > libraries of configurations for the system which need to be global.
> > ...
>
> > Is it pythonic?
>
> My approach in this situation is to use the Borg pattern instead
> of singeltons. This is really pythonic, very simple and usefull.
>
> Look athttp://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531
> The german wikipedia shows another solution using metaclasse:http://de.wikipedia.org/wiki/Singleton_(Entwurfsmuster)#Das_Borg-Pattern
>
> Greetings, Uwe

thanks uwe, doing some searching I ran into the borg pattern this
morning. Definitely relevant.

Thanks again and all for the feedback, I feel much reassured about the
options when this sort of thing is required.



More information about the Python-list mailing list