Appropriate use of Property()



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.

Thanks,
K
.



Relevant Pages

  • Re: Appropriate use of Property()
    ... two different methods (getAttrib() setAttrib()) for access of an ... attribute without giving direct access to the attribute, ... attribute with the syntax 'Object.attrib', ...
    (comp.lang.python)
  • Re: Appropriate use of Property()
    ... two different methods setAttrib()) for access of an ... attribute without giving direct access to the attribute, ... acces to attribute". ... attribute with the syntax 'Object.attrib', ...
    (comp.lang.python)