Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!bcyclone01.am1.xlned.com!bcyclone01.am1.xlned.com!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.026 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'logic': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:module': 0.09; 'def': 0.13; 'mistake.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'fixing': 0.22; 'header:In-Reply- To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints- To:1': 0.26; 'looks': 0.29; 'once.': 0.29; "d'aprano": 0.33; 'steven': 0.33; 'though.': 0.33; 'next': 0.35; 'done': 0.35; 'but': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'received:org': 0.37; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'more': 0.63; 'received:109': 0.75; 'obvious': 0.76; '..........': 0.84; 'becker': 0.84; 'complex,': 0.84; 'mistake': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robin Becker Subject: Re: A new module for performing tail-call elimination Date: Thu, 16 Jul 2015 10:13:29 +0100 References: <55a3dcd9$0$3024$426a34cc@news.free.fr> <55a76628$0$2846$c3e8da3$76491128@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 109.174.168.73 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <55a76628$0$2846$c3e8da3$76491128@news.astraweb.com> 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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1437038029 news.xs4all.nl 2938 [2001:888:2000:d::a6]:42607 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3188 X-Received-Body-CRC: 1485819571 Xref: csiph.com comp.lang.python:93916 On 16/07/2015 09:07, Steven D'Aprano wrote: ......... > Fixing the obvious mistake (failing to return anything) leads to the next > mistake. When all you have is a hammer, everything looks like a nail. > > def even(n): > return n%2 == 0 > > def odd(n): > return n%2 != 0 > ...... what about >>> def odd(n): ... return bool(n%2) ... >>> def even(n): ... return not odd(n) ... not much more complex, but the logic for A(n) and not A(n) is only done once. Not really much to do with TCO though. -- Robin Becker