Which way to say 'private'?

Daniel Klein danielk at aracnet.com
Thu Aug 21 18:45:09 CEST 2003

On Thu, 21 Aug 2003 11:42:02 -0400, "Sean Ross"
<sross at connectmail.carleton.ca> wrote:

>"Daniel Klein" <danielk at aracnet.com> wrote in message
>news:14f9kv4fvuf67k6j12lpgt6vk9dcpefchm at 4ax.com...
>> There are 2 ways to indicate private members of classes, by prepending
>> 1 or 2 underscore characters, the latter causing name mangling. My
>> question is: When would I use which kind to indicate privacy?
>Personally, I use single underscore to denote "protected", and double
>underscore to denote "private" (if I use them at all).

Thanks for the courtesy or your reply, Sean.

I should probably have mentioned that I am concerned about advertising the
'public' interface (so that users of the class know how best to use it and
what my intentions were) more than 'restricting' access to 'private' members,
which we all know is pretty much pointless in Python ;-)

Thanks again,


More information about the Python-list mailing list