Re: Help with Borg design Pattern

2008-06-30 Thread Maric Michaud
Le Monday 30 June 2008 10:52:24 Casey McGinty, vous avez écrit : > I'm running into a slight problem however that my run-time defined logging > level is not correctly set until after the module has initialized, > preventing any log messages from showing up. Is there a pythonic way to get > around t

Re: Help with Borg design Pattern

2008-06-30 Thread Casey McGinty
On Fri, Jun 27, 2008 at 5:25 PM, Maric Michaud <[EMAIL PROTECTED]> wrote: > Yes it is, but it's rather unneeded in Python, we prefer simply create a > module level dictionnary, these tricks are used in language like C++ or > Java. > > In python : > > mymodule.py : > > ModuleOptions = {} > > otherm

Re: Help with Borg design Pattern

2008-06-27 Thread Maric Michaud
Le Saturday 28 June 2008 03:47:43 Casey McGinty, vous avez écrit : > On Fri, Jun 27, 2008 at 3:21 PM, Casey McGinty <[EMAIL PROTECTED]> > > wrote: > > Hi, > > > > I'm trying to implement a simple Borg or Singleton pattern for a class > > that inherits from 'dict'. Can someone point out why this cod

Re: Help with Borg design Pattern

2008-06-27 Thread Casey McGinty
On Fri, Jun 27, 2008 at 3:21 PM, Casey McGinty <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to implement a simple Borg or Singleton pattern for a class that > inherits from 'dict'. Can someone point out why this code does not work? > > class MyDict( dict ): >__state = {} >def __init__(s

Help with Borg design Pattern

2008-06-27 Thread Casey McGinty
Hi, I'm trying to implement a simple Borg or Singleton pattern for a class that inherits from 'dict'. Can someone point out why this code does not work? class MyDict( dict ): __state = {} def __init__(self): self.__dict__ = self.__state a = MyDict() a['one'] = 1 a['two'] = 2 print a