Classes

Ian Kelly ian.g.kelly at gmail.com
Sat Nov 1 02:12:53 EDT 2014


On Fri, Oct 31, 2014 at 7:06 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> And there are times when using getters and setters is the right choice.
> Properties should only be used for quite lightweight calculations, because
> attribute access is supposed to be fast. If your calculation is complex,
> time-consuming or might fail, using a property is a bad idea and you should
> use an explicit getter method, possibly with a setter if needed.

I agree except that in this scenario you should probably use a verb
other than "get", since getters should also be fast.



More information about the Python-list mailing list