Single leading dash in member variable names?

Terry Reedy tjreedy at udel.edu
Tue Sep 11 17:34:03 EDT 2012


On 9/11/2012 4:53 PM, e.doxtator at gmail.com 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.

> PEP 8 says this is bad form.  What do you think?

Please quote the specific statement you want commented. The stdlib 
routinely uses _names for internal implementation objects. __ugh is 
perhaps never used.

-- 
Terry Jan Reedy




More information about the Python-list mailing list