Accessors in Python (getters and setters)

Lawrence Oluyede rhymes at myself.com
Mon Jul 10 08:24:48 EDT 2006


mystilleef <mystilleef at gmail.com> wrote:

> What is the Pythonic way of implementing getters and setters.

Using public members and turning them into properties when needed

> I've
> heard
> people say the use of accessors is not Pythonic. But why? 

Because there's no need to have them everywhere

> But now my code base is expanding and I'm beginning to appreciate the
> wisdom behind them. I welcome example code and illustrations.

Search for "python property"

-- 
Lawrence - http://www.oluyede.org/blog
"Nothing is more dangerous than an idea
if it's the only one you have" - E. A. Chartier



More information about the Python-list mailing list