Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #71151

Re: trailing underscores naming convention_

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'remind': 0.05; 'convention.': 0.07; 'method.': 0.07; 'coders': 0.09; 'conventions.': 0.09; 'occasionally': 0.09; 'trailing': 0.09; 'underscore': 0.09; 'python': 0.11; 'def': 0.12; 'event):': 0.16; 'naming': 0.16; 'pep8': 0.16; 'stuff.': 0.16; 'subclass': 0.16; 'underscores': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'code.': 0.18; 'bit': 0.19; 'basically': 0.19; 'normally': 0.19; 'thu,': 0.19; 'version.': 0.19; 'comfortable': 0.22; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'names.': 0.31; 'ok.': 0.31; 'purely': 0.31; 'class': 0.32; 'says': 0.33; 'standards': 0.33; 'trouble': 0.34; 'point.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'version': 0.36; 'described': 0.36; 'keyword': 0.36; 'method': 0.36; 'half': 0.37; 'two': 0.37; 'convention': 0.38; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'enough': 0.39; 'how': 0.40; 'chain': 0.60; 'most': 0.60; 'matter': 0.61; 'information': 0.63; 'name': 0.63; 'myself': 0.63; 'more': 0.64; 'different': 0.65; 'situation': 0.65; 'helping': 0.70; 'wanting': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=SEr2RuJuzDcyDs4bdo6VEq99uCmWTGFGVVcsX/Sfjs0=; b=ChNFORS5lWsDW+GFwVF1DdB0QVnZhnLqhXitBhkEw4T+79EU9HKBJXMApcqFxxLuam XZNsw/S72NoBsplwQU4E9X0NhE8aAX9LjuZpByW8+iofRlpDb26n9sk4v2Zhtep4+b14 sGh+5emb9CSRNF/5wgligOX6QWkECAmVnNZ5ox2lN6mtvmShGcY8nhOg6V278EohHEtv /YEiEyZAPsVFgoXUBsnhr93z5yYNUSGjCWIFSEZFJUJHSjiaWNSFGimhiAXmaCdOQRWz N3Jpq3yUUoNBq4Lxv9cP91hpo4YbimCPe9RPNn/FUgW9kXXl+xBNnyWVEbSaCqakPJve Qq9A==
X-Received by 10.67.13.134 with SMTP id ey6mr15780314pad.44.1399609480914; Thu, 08 May 2014 21:24:40 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <57d21b4f-10db-4fbf-82f4-d33250b14456@googlegroups.com>
References <57d21b4f-10db-4fbf-82f4-d33250b14456@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Thu, 8 May 2014 22:24:00 -0600
Subject Re: trailing underscores naming convention_
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.9812.1399609490.18130.python-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1399609490 news.xs4all.nl 2966 [2001:888:2000:d::a6]:45952
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:71151

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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