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
print MyDict()
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to