On 29 ene, 23:17, [EMAIL PROTECTED] wrote: > Property() can be used to rid ourselves of the extra effort of using > two different methods (getAttrib() setAttrib()) for access of an > attribute without giving direct access to the attribute, thus making > it more elegant. So, the outsider using my module accesses the > attribute with the syntax 'Object.attrib', but since this syntax looks > as if he is accessing the attribute (rather than through a > descrtiptor), should we subscribe to this syntax only when the > attribute is both readable and writable? i.e., > if I have an attribute which I strongly believe would always be only > readable, should I go with the old style 'Object.getAttrib()'? > Would like to know different perspectives.
I usually implement read only attributes using properties. Sometimes I may use getXXX() when it is slow to compute and I want to make explicit that it is a function call. Just my opinion. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list