On Mon, Jan 20, 2014 at 12:09 PM, Charles Hixson <charleshi...@earthlink.net> wrote:
> class RODict: > #Instance Variable Doc > ## @var _ddict > # This variable holds the reference to the dict. > > ## Class initializer. > # @param ddict The data dictionary to which this is a read only > # access. > # @throws TypeError if ddict is not a dict. > def __init__ (self, ddict = {}): > if not isinstance(ddict, dict): > raise TypeError("ddict must be a dict. It is " + > repr(ddict)) > self._ddict = ddict When I see this isinstance, I think "Gee, that means none of the dict-like-objects I recently compared would work with this class." The comparison is at the URL below; all the things compared are trees that provide a dictionary-like interface, but also find_min, find_max and can iterate in key order. I don't think any of them inherit from dict, but they are all dict-like in a duck-typed sense: http://stromberg.dnsalias.org/~strombrg/python-tree-and-heap-comparison/2014-01/ HTH -- https://mail.python.org/mailman/listinfo/python-list