Singleton Pattern and Python

Will Ware wware at
Sat Sep 29 05:23:28 CEST 2001

On Thu, 27 Sep 2001 21:51:44 -0000, hungjunglu at wrote:
> Can someone tell me why not just use a Python module to implement a
> singleton pattern? Or better, why is a Python module not considered a
> singleton? (That is, why no one ever menthioned about it?)

William Tanksley wrote:
> It's a singleton, but it doesn't have a class, can't inherit, and can't be
> inherited from.  It also requires a seperate Python file, and many people
> prefer single-file scripts.

Alex Martelli invented a nice, very short singleton pattern:

"How many roads must a man walk down?"  -- Bob Dylan
"Eleven"  -- Spinal Tap
Will Ware                       wware[at]alum[dot]mit[dot]edu

More information about the Python-list mailing list