"A.T.Hofkamp" <[EMAIL PROTECTED]> writes: [...] > I can derive from dict, but the problem with that is that I start with a > read/write dictionary, and I can only hope to plug all holes to prevent my > data > from leaking out. > By starting from 'object', I certainly don't have that problem, I start with a > closed bucket and punch holes in it in a controlled way. > (I rather have the program drop dead due to not having enough access than > have it continue with too much access causing havoc 500 statements later in a > totally unrelated area.) > > Rather than write a bunch of code like > > def __contains__(self, val): > return val in self.mydict > > I thought I'd simply do > > self.__contains__ == self.d.__contains__ > > which is exactly the same but less work (or so I thought), and possibly > slightly faster. > > Well, no such luck thus :-(
UserDict.DictMixin http://docs.python.org/lib/module-UserDict.html John -- http://mail.python.org/mailman/listinfo/python-list