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: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.025 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'override': 0.09; 'snippet': 0.09; 'def': 0.12; 'question.': 0.14; 'etc...': 0.16; 'event):': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'pep8': 0.16; 'underlying': 0.16; 'underscores': 0.16; 'wrote:': 0.18; 'library': 0.18; 'bit': 0.19; 'connects': 0.19; 'header:User-Agent:1': 0.23; 'example.': 0.24; 'header:In- Reply-To:1': 0.27; "doesn't": 0.30; 'code': 0.31; 'names.': 0.31; 'class': 0.32; 'probably': 0.32; 'extend': 0.32; 'skip:m 30': 0.32; 'guess': 0.33; 'skip:_ 10': 0.34; "i'd": 0.34; 'but': 0.35; 'add': 0.35; 'method': 0.36; 'shows': 0.36; 'example,': 0.37; 'two': 0.37; 'clear': 0.37; 'skip:o 20': 0.38; 'message- id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'received:org': 0.40; 'tell': 0.60; 'matter': 0.61; 'more': 0.64; 'here': 0.66; 'glance': 0.84; 'together,': 0.84 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Fri, 09 May 2014 10:35:09 -0600 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131118 Thunderbird/17.0.11 MIME-Version: 1.0 To: python-list@python.org Subject: Re: trailing underscores naming convention_ References: <57d21b4f-10db-4fbf-82f4-d33250b14456@googlegroups.com> <57b0d9ec-b8a4-4021-b25f-422a9fe11529@googlegroups.com> In-Reply-To: <57b0d9ec-b8a4-4021-b25f-422a9fe11529@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399653332 news.xs4all.nl 2954 [2001:888:2000:d::a6]:38194 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71180 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___') >