descriptor problems

Michele Simionato michele.simionato at gmail.com
Thu Sep 14 05:57:40 EDT 2006


Gary Stephenson wrote:
> # but I need to be able to update the value through the class
> # how do I do it?
> A.cls2 = 4     # whoops - we just overwrote the descriptor with an integer
>
> A.cls2.__set__(None,4)     # AttributeError: 'int' object has no attribute
> '__set__'

You need to define the descriptor at the metaclass level too.

               Michele Simionato




More information about the Python-list mailing list