properties + types, implementing meta-class desciptors elegantly?
mis6 at pitt.edu
Sat Jul 19 16:40:52 CEST 2003
bokr at oz.net (Bengt Richter) wrote in message news:<bfa97g$s5j$0 at 220.127.116.11>...
> Not sure exactly what you are doing, but what does
> object.__setattr__(client, self.name, value)
> do in your context in place of
> client.__dict__[ self.name ] = value
> Bengt Richter
I agree with Bengt, from your traceback it seems you are assigning directly
to client.__dict__, but you cannot do that (I think because client.__dict__
is a dictproxy object and not a real dictionary). The right way to
go is via object.__setattr__ , or type.__setattr__ in the case of
I guess you are aware of the metaclass+properties recipes in the
on-line cookbook, but just in case ...
More information about the Python-list