What is the naming convention for accessor of a 'private' variable?
benjamin.kaplan at case.edu
Thu Nov 19 03:50:14 CET 2009
On Wed, Nov 18, 2009 at 9:27 PM, Peng Yu <pengyu.ut at gmail.com> wrote:
> The above webpage states the following naming convention. Such a
> variable can be an internal variable in a class. I'm wondering what is
> the naming convention for the method that access such variable.
> - _single_leading_underscore: weak "internal use" indicator. E.g. "from M
> import *" does not import objects whose name starts with an underscore.
You never have any convention for a method that accesses the private
variable. In a language that has scope declarations, a method that
uses private variables is still declared public or private- there's no
special keyword for it.
More information about the Python-list