Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.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.023 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.02; 'cpython': 0.05; 'guido': 0.05; 'interpreter': 0.05; 'debugging': 0.07; 'calls.': 0.09; 'mess': 0.09; 'optimizing': 0.09; 'rejected': 0.09; 'subject:while': 0.09; "wouldn't": 0.14; 'arbitrarily': 0.16; 'bytecode': 0.16; 'reedy': 0.16; 'remedied': 0.16; 'subject:recursion': 0.16; 'wrote:': 0.18; 'stack': 0.19; 'header :User-Agent:1': 0.23; 'suggested': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'am,': 0.29; 'trace': 0.31; 'could': 0.34; 'but': 0.35; "didn't": 0.36; 'possible': 0.36; 'to:addr:python- list': 0.38; 'short': 0.38; 'does': 0.39; "couldn't": 0.39; 'to:addr:python.org': 0.39; 'ian': 0.60; 'more': 0.64; '100%': 0.77; 'investigated': 0.84; 'pardon': 0.84; 'received:195.238': 0.84; 'received:195.238.6': 0.84; 'received:belgacom.be': 0.84; 'received:isp.belgacom.be': 0.84; 'technically': 0.84; 'hand,': 0.93; 'serious': 0.97 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApMBALfAT1JbtpUq/2dsb2JhbAANS8IygnmBLoMZAQEBBDhRCxgJJQ8CRhMIArE3igeJFI9YFoQNA5gBlSY Date: Sat, 05 Oct 2013 09:39:40 +0200 From: Antoon Pardon User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130922 Icedove/17.0.9 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Tail recursion to while iteration in 2 easy steps References: <87had0axxy.fsf@dpt-info.u-strasbg.fr> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1380958849 news.xs4all.nl 16002 [2001:888:2000:d::a6]:44828 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:56172 Op 04-10-13 23:14, Terry Reedy schreef: > On 10/4/2013 6:46 AM, Ian Kelly wrote: > >> On the other hand, if you start optimizing every tail call and not >> just the recursive functions, then I can see where that could start to >> get problematic for debugging -- as arbitrary functions get removed >> from the stack traces just because they happened to end in tail calls. > > The idea of CPython space-optimizing tail calls when the call is made > has been suggested on python-ideas. Guido verified that it is > technically possible with the current bytecode interpreter but rejected > it because it would arbitrarily mess up stack traces. What does this mean? Does it mean that a naive implementation would arbitrarily mess up stack traces and he wasn't interested in investigating more sophisticated implementations? Does it mean he just didn't like the idea a stack trace wouldn't be a 100% represenatation of the active call history? Does it mean he investigated more sphisticated implementations but found them to have serious short comings that couldn't be remedied easily? -- Antoon Pardon