singletons
Uwe Schmitt
rocksportrocker at googlemail.com
Thu Jul 17 08:15:13 EDT 2008
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 at http://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
More information about the Python-list
mailing list