trailing underscores naming convention_

Metallicow metaliobovinus at gmail.com
Thu May 8 23:28:07 EDT 2014


I seem to be comfortable with all the information out around the net dealing
with python naming conventions. Occasionally I have to remind myself on some
of this stuff. The PEP8 does a good job for most of it, but I am having a bit
of trouble finding some more detailed information on the trailing half of
the underscores convention.

The PEP8 says that one_ underscore is basically for helping fix 
python keyword names.
OK. fair enough on that point.

But what is the standards for everything else... purely coders choice?...
...or other...
It would be nice if fellow pythoneers chimed in on the one or two trailing 
underscores convention and how the use it in their code. 

Ok so the situation is I have made myself a subclass of AuiManager.
In AuiManager there is a method named OnLeftDClick.
In my subclass I am not wanting to override(or hence copy the code into mine)
to get my same named method to work as normally with event.Skip().

What I am wanting to do is just add extra functionality to the 
event(it doesn't matter if the event comes before or after) without 
stomping on(overriding) the AuiManager method.

...so what would be proper here for my method name...?
one trailing underscore or two?
OnLeftDClick_(self, event):
or
OnLeftDClick__(self, event):

What is the norm for trailing underscores naming convention overall?
Mostly with func/meth/class naming, but attribute explanation would be nice also.



More information about the Python-list mailing list