Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'anyway.': 0.05; 'cpython': 0.05; 'interpreter': 0.05; 'discard': 0.07; 'returns,': 0.09; 'cc:addr:python-list': 0.11; 'jan': 0.12; '10:00': 0.16; 'expression,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'loop.': 0.16; 'none.': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '>>>': 0.22; 'memory': 0.22; 'cc:addr:python.org': 0.22; "shouldn't": 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; '13,': 0.31; 'away.': 0.31; 'received:google.com': 0.35; '14,': 0.36; 'should': 0.36; 'whatever': 0.38; 'pm,': 0.38; 'though,': 0.39; 'even': 0.60; 'above,': 0.60; 'ian': 0.60; 'simple': 0.61; '2015': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=Um9xX2w1QqQyxh4PIBResCz9fvhVYQ7078sWV0kijVM=; b=ro6zyYXEMlu9Ou83U3g9TVg6UKcW2df5nwWuGgByeQD42TEl2Ce2hgh8EUmS0n5CEv pejI0pVajlqv4/dII7tVZHiL1ivlIhMVSf9W585mBucD5aRhUCgYvmaRXG7fp7ujprx4 linROcz0+8ELvcaLGbvMRO43/Jgr4j9b9W+FKBjJMXrb1VcWlyPHdnAbYMTF2w2/f//1 6Z9thDu5XYxDiWS5Ix4S5E7A0bZ53eVzUtPL51qt4GdaSmbF5LzS24y6691QPpN4ruBO JgS4svDU+2jSJhtnv9GIxRn3YfVpesC+QrjZx0/eHTQs6ZdnRhob53R91lbiybGMsRRI Tm0A== MIME-Version: 1.0 X-Received: by 10.50.62.104 with SMTP id x8mr152990igr.2.1421175740663; Tue, 13 Jan 2015 11:02:20 -0800 (PST) In-Reply-To: References: <54ABB88A.7070504@r3dsolutions.com> <54ABC52A.1050507@davea.name> <54ABE383.3020801@r3dsolutions.com> <54AC97D9.4010504@r3dsolutions.com> <54ACAA04.60801@r3dsolutions.com> <54ADC99F.3020405@stoneleaf.us> <54B44A64.7010105@r3dsolutions.com> <54b4aded$0$2738$c3e8da3$76491128@news.astraweb.com> <87lhl7c5dt.fsf@elektro.pacujo.net> Date: Wed, 14 Jan 2015 06:02:20 +1100 Subject: Re: Comparisons and sorting of a numeric class.... From: Chris Angelico Cc: Python Content-Type: text/plain; charset=UTF-8 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: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1421175743 news.xs4all.nl 2901 [2001:888:2000:d::a6]:49454 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:83719 On Wed, Jan 14, 2015 at 5:56 AM, Ian Kelly wrote: > On Tue, Jan 13, 2015 at 4:20 AM, Chris Angelico wrote: >> On Tue, Jan 13, 2015 at 10:00 PM, Marko Rauhamaa wrote: >>> The code above, though, shouldn't consume memory since it is a simple >>> tail-recursive loop. >> >> Only if the interpreter can optimize it away. Bear in mind that it >> doesn't _return_ the result of that expression, so it needs to take >> whatever f() returns, discard it, and return None. > > And CPython doesn't even try to optimize tail recursion anyway. I presumed that Marko's "shouldn't" was "CPython should be smarter than this". ChrisA