Brian Blais <bbl...@gmail.com>: > class Struct(dict): > > def __getattr__(self,name): > > try: > val=self[name] > except KeyError: > val=super(Struct,self).__getattribute__(name) > > return val > > def __setattr__(self,name,val): > > self[name]=val
Cool. I wonder if that should be built into dict. Why can't I have: >>> d = {} >>> d.x = 3 >>> d {'x': 3} Marko -- https://mail.python.org/mailman/listinfo/python-list