Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71151
| References | <57d21b4f-10db-4fbf-82f4-d33250b14456@googlegroups.com> |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | 2014-05-08 22:24 -0600 |
| Subject | Re: trailing underscores naming convention_ |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.9812.1399609490.18130.python-list@python.org> (permalink) |
On Thu, May 8, 2014 at 9:28 PM, Metallicow <metaliobovinus@gmail.com> wrote:
> 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.
I'm not aware of any convention for trailing underscores other than
the one described in PEP8.
>
> 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.
If you use a different name in the subclass then whatever code calls
the method will continue to call the base class version instead of
your subclassed version. Is there a reason you don't just use super()
to chain the call to the base method?
def OnLeftDClick(self, event):
event.Skip()
super(MyClassName, self).OnLeftDClick(event)
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
trailing underscores naming convention_ Metallicow <metaliobovinus@gmail.com> - 2014-05-08 20:28 -0700
Re: trailing underscores naming convention_ Ian Kelly <ian.g.kelly@gmail.com> - 2014-05-08 22:24 -0600
Re: trailing underscores naming convention_ Metallicow <metaliobovinus@gmail.com> - 2014-05-08 22:03 -0700
Re: trailing underscores naming convention_ Metallicow <metaliobovinus@gmail.com> - 2014-05-08 22:49 -0700
Re: trailing underscores naming convention_ Peter Otten <__peter__@web.de> - 2014-05-09 11:10 +0200
Re: trailing underscores naming convention_ Metallicow <metaliobovinus@gmail.com> - 2014-05-09 03:22 -0700
Re: trailing underscores naming convention_ Peter Otten <__peter__@web.de> - 2014-05-09 13:49 +0200
Re: trailing underscores naming convention_ "Albert Visser" <albert.visser@gmail.com> - 2014-05-09 16:24 +0200
Re: trailing underscores naming convention_ Michael Torrie <torriem@gmail.com> - 2014-05-09 10:35 -0600
Re: trailing underscores naming convention_ Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-10 00:00 +0000
csiph-web