[Python-Dev] PEP 8 updates/clarifications

Jim Fulton jim at zope.com
Mon Dec 12 15:28:33 CET 2005


Gustavo J. A. M. Carneiro wrote:
...

>   IMHO, if getting a property involves a potentially long computation,
> it's better to have an accessor method rather than a property;
> xpto.getFoobar() hints right away the programmer that to access that
> value some code has to be run, so the programmer is more likely to store
> the result in a temp variable for use in the same context, instead of
> calling it multiple times.  Similar reasoning applites for setter vs
> property =.

That's why, in my suggested writeup, I suggested that attributes should
be used if the accessors are trivial.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Python-Dev mailing list