variable naming query
Jean-Paul Calderone
exarkun at divmod.com
Thu Jul 12 07:38:42 EDT 2007
On Thu, 12 Jul 2007 10:33:03 -0000, loial <jldunn2000 at googlemail.com> wrote:
>I'ma a newbie python user and would like clarification on variable
>naming conventions.
>
>What is the difference between
>
>self.myvariable
This is the convention for public attributes.
>self._myvariable
This is the convention for private attributes.
>self.__myvariable
This causes the name to be mangled in an inconvenient way by the runtime. You
probably /don't/ want to name your variables like this, since the consequence
is primarily that the result is harder to use.
Jean-Paul
More information about the Python-list
mailing list