Help with Borg design Pattern
Casey McGinty
casey.mcginty at gmail.com
Fri Jun 27 21:21:39 EDT 2008
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()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080627/bb9191ba/attachment.html>
More information about the Python-list
mailing list