A matter of style: class.foo = bar vs. class.set_foo(bar)

Aahz Maruch aahz at panix.com
Fri Nov 10 21:08:41 CET 2000

In article <slrn90okck.ilq.grey at teleute.rpglink.com>,
Steve Lamb <morpheus at here.not.there> wrote:
>OK, when setting a variable from program logic is it acceptable to set it
>directly or should one create a method to set the variable?

Generally speaking, because Python does not have private parts, you only
use a method when you want to trigger an action in addition to just
changing the variable's value.
                      --- Aahz (Copyright 2000 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

"Every flame is sacred, every flame is great."  --Orc

More information about the Python-list mailing list