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


Groups > comp.lang.python > #71180

Re: trailing underscores naming convention_

Date 2014-05-09 10:35 -0600
From Michael Torrie <torriem@gmail.com>
Subject Re: trailing underscores naming convention_
References <57d21b4f-10db-4fbf-82f4-d33250b14456@googlegroups.com> <57b0d9ec-b8a4-4021-b25f-422a9fe11529@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.9824.1399653332.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 05/08/2014 11:49 PM, 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.

In a case like this I'd probably prefer to number the methods rather
than add underscores to the end of the names.  My current font, for
example, connects the underscores together, so it's a bit hard from a
glance to tell if it's just two underscores or three.

I'd prefer OnLeftDClick1, OnLeftDClick2, OnLeftDClick3, for example.

And I also prefer pep8 method names as well, on_left_dclick1, etc.  But
when the underlying library doesn't follow pep8, then I guess it does
not matter (self.Bind is from the library I presume).


> class MainAuiManager(aui.AuiManager): def __init__(self,
> managed_window=None, agwFlags=0) aui.AuiManager.__init__(self,
> managed_window, agwFlags)
> 
> ## self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDClick) 
> self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDClick_) 
> self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDClick__) 
> self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDClick___) # etc...
> 
> ## def OnLeftDClick(self, event): ##     """This will override the
> aui.AuiManager.OnLeftDClick event method.""" ##     event.Skip() ##
> print('OnLeftDClick')
> 
> def OnLeftDClick_(self, event): """This will extend the
> aui.AuiManager.OnLeftDClick event method.""" event.Skip() 
> print('OnLeftDClick_')
> 
> def OnLeftDClick__(self, event): """This will extend the
> aui.AuiManager.OnLeftDClick event method.""" event.Skip() 
> print('OnLeftDClick__')
> 
> def OnLeftDClick___(self, event): """This will extend the
> aui.AuiManager.OnLeftDClick event method.""" event.Skip() 
> print('OnLeftDClick___')
> 

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