How does Mr. Martelli's Borg recipe work ?
Steven Taschuk
staschuk at telusplanet.net
Wed Jul 23 14:48:00 EDT 2003
Quoth John Roth:
[...]
> I can kind of understand the justification for the Borg pattern
> in Python releases before 2.2, because there was no way of
> creating a true singleton in those releases. However, in 2.2 and
> later, it's really easy to create one using new style classes.
[...implementing singletons with __new__...]
> That being the case, I'd like to see the Borg pattern go the way
> of a fondly remembered hack that is no longer necessary.
Just out of curiosity: why do you prefer singletons to Borgs in
the first place?
(I don't see Borg as a hack to get the behaviour of a singleton; I
see it as a more direct way to solve the problem which singletons
are supposed to solve. Thus to me Borg is actually preferable, in
those exceedingly rare cases when that problem actually arises.)
--
Steven Taschuk staschuk at telusplanet.net
"I may be wrong but I'm positive." -- _Friday_, Robert A. Heinlein
More information about the Python-list
mailing list