Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.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.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'think,': 0.07; '__init__': 0.09; 'friday,': 0.09; 'method,': 0.09; 'replied': 0.09; 'snippet': 0.09; 'trailing': 0.09; 'underscore': 0.09; 'question.': 0.14; '"official"': 0.16; 'bind': 0.16; 'client:': 0.16; 'subclass': 0.16; 'underscores': 0.16; 'wrote:': 0.18; 'meant': 0.20; 'header:User-Agent:1': 0.23; 'question': 0.24; 'header:In-Reply-To:1': 0.27; 'code': 0.31; 'getting': 0.31; 'fri,': 0.33; 'guess': 0.33; 'actual': 0.34; 'something': 0.35; 'definition': 0.35; 'but': 0.35; 'received:google.com': 0.35; '+0200,': 0.36; 'done,': 0.36; 'method': 0.36; 'shows': 0.36; 'clear': 0.37; 'convention': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'called': 0.40; 'url:mail': 0.40; 'kind': 0.63; 'more': 0.64; 'here': 0.66; 'close': 0.67; 'otten': 0.84; 'vriendelijk': 0.84; 'albert': 0.91; 'differences': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:to:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=2fWA36rBo9eutbcvoiyMOrqoDdEtyc5ds/eMwT2dW7Q=; b=rgIZgUTLzWMsOYfg24Ea5BpKnX/PeOf4R2j7KcCf8Q7+Z8SvW48crJVbirKQQp+E0i chTKOL//7uPbIqGXqdJVv+uXBqPEwJjop8gNt31rmsPjgx4+6/deg2T3QjQ4q8YayDer lR0vSD0IvEcUBiRgLesSnTTK0NCPyXV5Y0KJUwLySfU3At4e4GfaTg8RWAFlf61beMX1 hFahXtBMpMvPXGq5JXbwe4rv2z5e8YOd4VjLqsZDyjMM6xYOlFIDeMtvRCpsaaShIGxX PUDc4HhnDaMVflS4VCLVRjgmppTCbaojpkwp6oQXu2DY/fl1vIg5nDgo5W9dkjJF0/1p Dfyg== X-Received: by 10.15.31.70 with SMTP id x46mr13894297eeu.26.1399645459763; Fri, 09 May 2014 07:24:19 -0700 (PDT) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes 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> <8b8daad1-0e84-4c2f-a91c-696487df2819@googlegroups.com> Date: Fri, 09 May 2014 16:24:17 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Albert Visser" In-Reply-To: <8b8daad1-0e84-4c2f-a91c-696487df2819@googlegroups.com> User-Agent: Opera Mail/12.16 (Linux) 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: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399645466 news.xs4all.nl 2886 [2001:888:2000:d::a6]:56626 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71173 On Fri, 09 May 2014 12:22:56 +0200, Metallicow 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/