[Tutor] Allow only one instance of a process

Kent Johnson kent37 at tds.net
Tue May 19 23:24:44 CEST 2009


On Tue, May 19, 2009 at 4:09 PM, Roger <roger.varley at googlemail.com> wrote:

> As a Java programmer just starting with Python, this answer surprised me. I
> would've been googling for the Python equivalent of the Singleton pattern.
> I guess it's going to take longer than I thought to get my head around the
> differences.

A Singleton is a way to allow only a single instance of a class within
a single running program (process). The OP was asking how to ensure he
only created one process running a program. That is a very different
problem.

And yeah, singletons are evil and usually better served by modules in Python.

Kent


More information about the Tutor mailing list