Steven D'Aprano steve at
Wed Oct 10 17:18:56 CEST 2007

On Wed, 10 Oct 2007 06:57:15 -0700, Carl Banks wrote:

> On Oct 10, 9:39 am, Steven D'Aprano <st... at REMOVE-THIS-
>> wrote:
>> On Wed, 10 Oct 2007 09:36:56 +0000, pythoncurious wrote:
>> > So how do people solve this? Is there an obvious way that I missed?
>> Mostly by avoiding singletons. Why do you need only one instance?
>> Perhaps you should consider the Borg pattern instead.
> That wouldn't help.  In the OP's case, it would create two borgs.

Two borgs, or two million, the whole point of using borgs is that it 
doesn't matter.

> Did
> anyone actually read the OP's post?  Or is this just an opportunity to
> pimp libraries and bicker about style?

Well, let's see now... the OP says:

"I've been trying to get some sort of singleton working in python, but
I struggle a bit and I thought I'd ask for advice."

If we take each word to have it's normal English meaning, then the OP is 
struggling to get a singleton working correctly in Python. The way I 
solve that problem is to deftly side-step it by not using a singleton.

("Doctor, it hurts when I do this."
"Then don't do it.")

Of course, if there is some other meaning to the OP's post, then possibly 
I've completely misunderstood it. Would you mind telling me what you've 
seen that the rest of us haven't?


More information about the Python-list mailing list