Path: csiph.com!usenet.pasdenom.info!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.xs4all.nl!newsfeed7.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'value,': 0.03; 'from:addr:yahoo.co.uk': 0.05; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:module': 0.09; 'python.': 0.11; 'language,': 0.11; 'added:': 0.16; 'gregory': 0.16; 'mistake.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'redundant,': 0.16; 'spurious': 0.16; 'written.': 0.16; 'wrote:': 0.16; 'language': 0.19; 'lawrence': 0.22; 'programming': 0.22; 'code,': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'example': 0.26; 'header:X-Complaints-To:1': 0.26; 'looks': 0.29; 'behaviour': 0.29; 'does,': 0.29; 'tail': 0.29; 'thinks': 0.29; 'there.': 0.30; "i'd": 0.31; 'language.': 0.32; 'call,': 0.33; 'clear': 0.35; 'but': 0.36; 'keyword': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'received:org': 0.37; 'someone': 0.38; 'why': 0.39; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'mark': 0.40; 'still': 0.40; 'avoid': 0.61; 'charset:windows-1252': 0.62; 'our': 0.64; 'obvious': 0.76; 'received:89': 0.80; 'demonstrates': 0.84; 'idiom': 0.84; 'pythonistas,': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: A new module for performing tail-call elimination Date: Sun, 19 Jul 2015 01:09:49 +0100 References: <55a3dcd9$0$3024$426a34cc@news.free.fr> <55A6280C.3090602@rece.vub.ac.be> <55A76116.7070708@rece.vub.ac.be> <87lhefanui.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-89-240-174-121.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1437264610 news.xs4all.nl 2913 [2001:888:2000:d::a6]:53911 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:94073 On 18/07/2015 23:39, Gregory Ewing wrote: > Marko Rauhamaa wrote: >> At any rate, it demonstrates how the idiom has its place in Python. > > Perhaps it does, but I think I'd still prefer it to be > explicit. > > The call in Marko's example is not actually a tail call > as written. To make it a tail call, a return would need > to be added: > > > return child.setvalue(keyseq, value, offset + 1) > > To someone reading the code, it's not obvious why the > return is there. It looks redundant, and is likely to > get removed by someone who thinks it's a mistake. A time to use perhaps the most abused part of any programming language, a comment? > > Using a dedicated keyword would make it clear that tail > call behaviour is being relied upon, and avoid looking > like a spurious return. > +1 -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence