Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed8.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.048 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'discard': 0.05; 'python': 0.10; '"this': 0.13; 'keyword.': 0.16; 'mistake.': 0.16; 'wrote:': 0.16; '2015': 0.20; 'explicit': 0.22; 'function,': 0.22; 'header :In-Reply-To:1': 0.24; 'mon,': 0.24; 'chris': 0.26; 'message- id:@mail.gmail.com': 0.27; 'function': 0.28; '13,': 0.29; 'tail': 0.29; 'subject:/': 0.30; 'another': 0.32; "can't": 0.32; 'point': 0.33; 'call,': 0.33; 'optimize': 0.33; 'received:google.com': 0.35; 'but': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'say': 0.37; 'means': 0.39; 'to:addr:python.org': 0.40; 'side': 0.62; 'jul': 0.72; '(also,': 0.84; 'lacks': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=wkqPAPgm9GUlkzPrluzj2zG+KYEFlSw6RO3XssWgqZ0=; b=C8EgD4VhcW3D62qAEeNl23ywS+9UugXlJymztH2a/lHiv6n5H+wwVY3tgpunLVGbbT YLEFt6ZXrOcVGG96MKzjRWmHZEF7Yldf/FVuIBqsFIaSUMD3PaFJ+E0M93vGrMLcgJA3 IHxjHXAa0TY/al9USzLUrVmxc+si6QA59LXHg/QjCostt5rBUfN04G1dwS15TtNqaOih HVlmuOY/xagyBZUQIMBCNBMpFw8sE7/jZNHO0KvwtuqblXYB+QzFEwEfxDeN+daTjkFI vAM4RbqKNuFuHCXfX488TfVxIsE69KGoAyqHJx3xRWLjRDp5kEyNDtOxahfvDU4O3R77 UPrw== X-Received: by 10.129.56.70 with SMTP id f67mr42503063ywa.85.1436852822768; Mon, 13 Jul 2015 22:47:02 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <55A3A853.4040006@rece.vub.ac.be> <55A3C366.6060602@rece.vub.ac.be> <87fv4r1fre.fsf@jester.gateway.sonic.net> From: Ian Kelly Date: Mon, 13 Jul 2015 23:46:23 -0600 Subject: Re: Possibly Pythonic Tail Call Optimization (TCO/TRE) To: Python Content-Type: text/plain; charset=UTF-8 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: 9 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1436852831 news.xs4all.nl 2896 [2001:888:2000:d::a6]:56737 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:93786 On Mon, Jul 13, 2015 at 11:25 PM, Chris Angelico wrote: > (Also, side point: Python can't actually optimize the above function, > because it actually means "call quicksort, then discard its return > value and return None". A true tail call has to return the result of > the recursive call, and Python lacks a way to say "this function will > always return None". But that's trivial.) Another point in favor of an explicit tail-call keyword. Then one couldn't make that mistake.