Ticket #779 (closed enhancement: fixed)
|Reported by:||sean@…||Owned by:||anonymous|
I was just poking around util.py, and noticed DictObj?. This class seems only partially implemented (0.9a4), its purpose appears to be to "Make a dict look like an object." For this to be fully accurate it should also implement __setattr__ and __delattr__, as of 0.9a4 it only implements __getattr__. Also, the current implementation defined its own, very minimal, method, this is unnecessary as __getitem__ etc. have the same signature as __getattr__. My proposed implementation is as follows:
class DictObj(dict): """Make a dict look like an object.""" __getattr__ = dict.__getitem__ __setattr__ = dict.__setitem__ __delattr__ = dict.__delitem__
This is all that's necessary to make a dict look, feel, and act like a classic object.