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


Groups > comp.lang.python > #71173

Re: trailing underscores naming convention_

Subject Re: trailing underscores naming convention_
References <57d21b4f-10db-4fbf-82f4-d33250b14456@googlegroups.com> <57b0d9ec-b8a4-4021-b25f-422a9fe11529@googlegroups.com> <mailman.9818.1399627734.18130.python-list@python.org> <8b8daad1-0e84-4c2f-a91c-696487df2819@googlegroups.com>
Date 2014-05-09 16:24 +0200
From "Albert Visser" <albert.visser@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.9822.1399645466.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, 09 May 2014 12:22:56 +0200, Metallicow <metaliobovinus@gmail.com>  
wrote:

> On Friday, May 9, 2014 3:10:26 AM UTC-6, Peter Otten wrote:
>> Metallicow wrote:
>>
>> > I guess to be more clear here is a small code snippet that shows what  
>> is
>> > happening more readably. Hence the underscores question.
>>
>> Working with multiple names with small differences is error-prone.

Definitely.

>
> Anyway, the small snippet just shows that this can be done, but the  
> actual
> question you replied to you left unanswered. It is about the trailing  
> underscores.
>

It's not an "official" convention I think, but a (single) trailing  
underscore is mainly meant to create something that is close to an  
original definition without shadowing it.
If you subclass an object and bind a thusly underscored method to an event  
to which the original is already bound in the superclass's __init__  
method, they are both getting called on the event unless you do not call  
the superclass's __init__() in your own __init__().

-- 
Vriendelijk groeten / Kind regards,

Albert Visser

Using Opera's mail client: http://www.opera.com/mail/

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