Path: csiph.com!usenet.pasdenom.info!poup.poupinou.org!news.roellig-ltd.de!open-news-network.org!border2.nntp.ams1.giganews.com!border1.nntp.ams1.giganews.com!nntp.giganews.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'semantic': 0.07; 'cc:addr :python-list': 0.09; 'integers': 0.09; 'stack': 0.13; 'explicitly': 0.15; '--debug': 0.16; 'distinct': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'permits': 0.16; 'tackling': 0.16; 'wrote:': 0.16; 'instance,': 0.18; 'integer': 0.18; 'hack': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'assumes': 0.22; 'disable': 0.22; 'header:In-Reply-To:1': 0.24; 'chris': 0.26; 'not.': 0.27; 'wonder': 0.27; 'message-id:@mail.gmail.com': 0.27; '14,': 0.27; 'arithmetic': 0.29; 'equivalent.': 0.29; 'subject:/': 0.30; 'certainly': 0.30; 'anyone': 0.32; 'problem': 0.33; 'optimize': 0.33; 'definition': 0.34; 'tue,': 0.34; 'received:google.com': 0.35; 'done': 0.35; 'faster': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'rather': 0.39; 'your': 0.60; 'default': 0.61; 'jul': 0.72; 'chrisa': 0.84; 'to:none': 0.91 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=gRP6MCcaLM3IjuhWhdrlu9X5zKLtev3b+T7RuQEGO2Y=; b=FDkJIVfNrbBU7Dn7VsmYjO6EtYZWNkp4ixKX0RV+kMjTto+joWIIHGbE6chS4EFkKS 9Lsj8mv/5qTdq8/Stmjypb13TSFh7X+unFEIc1pXwQ0B1MjcCE0akhRfboY3RxptMV2R A4OaNvns6l8+bqCDfjexCmNgYnoTLUkQyI/2eIcw+fVSPFTQKZiyLYyNzF32izZJSueS MXBQtOHLf3z8fWGQVcaMUXX/AcCSIGwQUIFk21jO28pHv/5QhYkcrbBhWapCctvoZK7+ uvYHjgkP77m4vFC1mlGwAvyvEblGREkS+goBK/89nm2/fhQEEJ4p+rQ7USyTkEabhabi FsgA== MIME-Version: 1.0 X-Received: by 10.50.122.65 with SMTP id lq1mr3057811igb.56.1436878548308; Tue, 14 Jul 2015 05:55:48 -0700 (PDT) In-Reply-To: <87d1zunctp.fsf@elektro.pacujo.net> References: <55A3A853.4040006@rece.vub.ac.be> <55A3C366.6060602@rece.vub.ac.be> <87fv4r1fre.fsf@jester.gateway.sonic.net> <87bnff1eks.fsf@jester.gateway.sonic.net> <87d1zunctp.fsf@elektro.pacujo.net> Date: Tue, 14 Jul 2015 22:55:48 +1000 Subject: Re: Possibly Pythonic Tail Call Optimization (TCO/TRE) From: Chris Angelico Cc: "python-list@python.org" 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1436878550 news.xs4all.nl 2824 [2001:888:2000:d::a6]:40318 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:93806 On Tue, Jul 14, 2015 at 10:28 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> Done explicitly like this, it avoids the problem of bad tracebacks, >> because by definition you would use it only when you want the current >> stack frame to be dropped. I wonder how hard it would be to hack this >> into CPython... Anyone feel like tackling it? > > I would rather optimize by default and disable optimizations with > --debug or equivalent. That assumes that it's simply an optimization. This is a distinct semantic change. Would you, for instance, want all of your arithmetic to be rounded to integer because integers are faster - and then disable this "optimization" with a flag that permits floating-point arithmetic? Certainly not. ChrisA