Steven Bethard wrote:
Nick Coghlan wrote:



class attr_view(object): def __init__(self, data): self.__dict__ = data


I think the idea definitely deserves mention as a possible implementation strategy in the generic objects PEP, with the data argument made optional:


That's basically what the current implementation does (although I use 'update' instead of '='). The code is complicated because the implementation also takes all the argument types that dicts take.

STeVe

Have you noted the similarity of bunch and types.ModuleType?

perhaps module.__init__ could take an additional keyword argument to set its __dict__

Michael

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to