On Sat, 07 May 2005 22:28:34 +1000, Steven D'Aprano wrote:
> I've been working with the Borg design pattern from here:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531
Thanks to everyone who took the time to answer. I've learnt a lot from the
discussion, not the least of which was
On Sun, 08 May 2005 02:42:09 +1000, Steven D'Aprano <[EMAIL PROTECTED]> wrote:
>On Sat, 07 May 2005 08:35:21 -0700, [EMAIL PROTECTED] wrote:
>
>> See mr Martellis comment of 2001/09/06 in mentiond recipe, you then get
>> something like this
>>
>> -#!/usr/bin/env python
>> -class Borg(object):
>>
On Sun, 08 May 2005 02:42:09 +1000, Steven D'Aprano wrote:
> I'm thinking what I might need is a function that generates a Borg-like
> class. So I would do something like:
>
> Rabbit = MakeBorgClass()
> # Rabbit is now a class implementing shared state
> # all instances of Rabbit share the same st
On Sat, 07 May 2005 22:28:34 +1000, Steven D'Aprano <[EMAIL PROTECTED]> wrote:
>I've been working with the Borg design pattern from here:
>http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531
>
>and I'm having problems subclassing it.
>
>I'm a newbie, so I've probably missed something obv
On Sat, 07 May 2005 08:35:21 -0700, [EMAIL PROTECTED] wrote:
> See mr Martellis comment of 2001/09/06 in mentiond recipe, you then get
> something like this
>
> -#!/usr/bin/env python
> -class Borg(object):
> -_shared_state = {}
> -def __init__(self):
> -self.__dict__ = self._shar
See mr Martellis comment of 2001/09/06 in mentiond recipe, you then get
something like this
-#!/usr/bin/env python
-class Borg(object):
-_shared_state = {}
-def __init__(self):
-self.__dict__ = self._shared_state
-
-class Duck(Borg):
-def __init__(self):
-super(Duck, se
I've been working with the Borg design pattern from here:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531
and I'm having problems subclassing it.
I'm a newbie, so I've probably missed something obvious.
I want two Borg-like classes where all instances share state within each
class,