Assigning to self

Frans Englich frans.englich at telia.com
Mon Jan 17 16:43:23 EST 2005


On Monday 17 January 2005 21:24, Peter Otten wrote:
> Frans Englich wrote:
> > On Monday 17 January 2005 20:03, John Roth wrote:
> >> "Frans Englich" <frans.englich at telia.com> wrote in message
> >
> > <snip>
> >
> >> In other words, you're trying to create a singleton. In general,
> >> singletons are frowned on these days for a number of reasons,
> >> not least because of the difficulty of testing them.
> >
> > Then I have some vague, general questions which perhaps someone can
> > reason from: what is then the preferred methods for solving problems
> > which requires Singletons? Is it only frowned upon in Python code?
>
> Sorry, no answer here, but do you really want a singleton?
>
> Singleton: "Ensure a class only has one instance, and provide a global
> point of access to it"
>
> whereas
>
> Flyweight: "Use sharing to support large numbers of fine-grained objects
> efficiently"
>
> as per "Design Patterns" by Gamma et al.

Hehe :) Singleton sounds like what I want, but OTOH I do not know what 
Flyweight is, except for sounding interesting. Darn, I really must save for 
that Design Patterns by GOF.


Cheers,

		Frans




More information about the Python-list mailing list