Single leading dash in member variable names?

e.doxtator at gmail.com e.doxtator at gmail.com
Wed Sep 12 11:23:49 EDT 2012


On Tuesday, September 11, 2012 5:02:31 PM UTC-5, Erik Max Francis wrote:
> On 09/11/2012 01:53 PM, me wrote:
> 
> > On Tuesday, September 11, 2012 2:06:45 PM UTC-5, Ian wrote:
> 
> >> On Tue, Sep 11, 2012 at 12:45 PM,  I wrote:
> 
> >>> What is the significance of the leading underscore in "self._bongo"?  I've seen this a few times and, after looking through PEP 8, I didn't see anything relevant, but I could have missed it.
> 
> >>
> 
> >> Single leading underscore is a convention indicating that the name
> 
> >> should be considered private and not used externally.  It's a softer
> 
> >> version of the double leading underscore that means basically the same
> 
> >> thing but has syntactic significance.
> 
> >
> 
> > Thank you!
> 
> >
> 
> > PEP 8 says this is bad form.  What do you think?
> 
> 
> 
> Where does it say that?

Apologies.  It's in David Goodger's "Code Like A Pythonista" in the "Naming" section. (http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#naming)



More information about the Python-list mailing list