[Python-Dev] Re: LOAD_NAME & classes

Alex Martelli aleax@aleax.it
Wed, 24 Apr 2002 00:09:58 +0200


On Wednesday 24 April 2002 00:04, Patrick K. O'Brien wrote:
> [Aahz]
>
> > I noted in the FAQ entry that importing a module is also the Pythonic
> > answer to the Singleton design pattern, so people searching for
> > Singleton should find that.
>
> Send them to Alex's article: http://www.aleax.it/5ep.html

Using a module is a better answer over 90% of the time.  Most people think 
of Singleton "by reflex" when they believe "there's gonna be only one of
these", rather than when they really need to solve the forces covered in
the Gof4's Singleton DP, first and foremost subclassability.


Alex