Borg - is that a singleton?
Graham Fawcett
graham__fawcett at hotmail.com
Sat Mar 1 18:55:41 EST 2003
Alex Martelli <aleax at aleax.it> wrote in message news:<T5Z7a.253209$0v.7059112 at news1.tin.it>...
>
> Too much work! Just:
>
> class Foo(Borg): _shared_state = {}
>
> > class Bar:
> > __shared_state = {}
> > def __init__(self):
> > self.__dict__ = self.__shared_state
>
> Ditto: just
>
> class Bar(Borg): _shared_state = {}
Beautiful!
-- Graham
More information about the Python-list
mailing list