Detecting a new style class

Aahz aahz at pythoncraft.com
Fri Apr 26 17:43:00 EDT 2002


In article <mailman.1019640045.27779.python-list at python.org>,
Graham Ashton  <gashton at cmedltd.com> wrote:
>On Tue, 2002-04-23 at 19:21, Aahz wrote:
>> In article <mailman.1019552082.8541.python-list at python.org>,
>> Graham Ashton  <gashton at cmedltd.com> wrote:
>>>
>>>>>> class A(AbstractSingleton, object):
>>>...   pass
>> 
>> Maybe you should tell us a bit more about what you're trying to do so
>> that you needn't rely on crufty internal stuff to get the correct result.
>
>Okay, good point. I'm using the Alex's Borg pattern in place of a
>singleton, as shared state will do quite nicely. I'm also trying to
>protect myself from getting caught out by new style classes (in other
>words it doesn't work -- in general -- for classes derived from, for
>example, dict).

What do you need Borg for?  Alex himself has agreed that using a module
as a singleton is the correct answer 80-90% of the time.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"I used to have a .sig but I found it impossible to please everyone..."  --SFJ



More information about the Python-list mailing list