"Carroll, Barry" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED]
> * ... the assignment operator is used to assign an > * object to a name in the current namespace... IOW, you cannot "overload > * the assignment operator." > (wesley chun) This is the key concept, if you want to be able to "see" assignments, you should work with a namespace (a dictionary is enough...) > * result = property(get_result, set_ result, doc='result of operations') > > I have tested this using the admittedly simple-minded code snipped > below. > >>>>>>>>>>> > @BCARROLL[Python]|3> class Aclass: > |.> def __init__(self): > |.> __result = None > |.> def get_result(self): > |.> return self.__result > |.> def set_result (self, result): > |.> self.__result = result > |.> result = property(get_result, set_result, > doc='result of expression') > |.> > @BCARROLL[Python]|5> A = Aclass() > @BCARROLL[Python]|7> a.result = 2*3 > @BCARROLL[Python]|8> a.result > <8> 6 > @BCARROLL[Python]|9> a.result = 25.0 * 5.25 > @BCARROLL[Python]|10> a.result > <10> 131.25 > @BCARROLL[Python]|11> >>>>>>>>>>> Notice that you can delete ALL those lines of code, leaving a bare: class Aclass: passs and you will get EXACTLY the same results. In this case -and this are not my words- properties are a waste of programmer time, processor time and disk space. Of course properties are very useful, but when you need to do something "more" than just storing and retrieving a single value. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list