Standard behaviour of a getSomething method

Stefan Schwarzer sschwarzer at
Sun Jul 27 02:00:46 CEST 2003

John Roth wrote:
> "Stefan Schwarzer" <sschwarzer at> wrote in message
> news:bfulr8$5mi$1 at
>> Somewhat, I dislike the sometimes recommended __getattr__/__setattr__
>> approach. I wouldn't like to have something like
> That sounds more than a bit heavyhanded to me. The more
> general practice is simply to name private attributes with a
> leading underscore. Then you can verify that there aren't any
> improper references by scanning the source for references to
> underscored variables that don't start with "self._".

I refered to public attributes here. For private (i. e. implementation-
specific) attributes I would just use the leading-underscore convention,
like you.


More information about the Python-list mailing list