empty classes as c structs?
Michael Spencer
mahs at telcopartners.com
Sat Feb 5 15:26:09 EST 2005
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
More information about the Python-list
mailing list