Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Gregory Ewing Newsgroups: comp.lang.python Subject: Re: Possibly Pythonic Tail Call Optimization (TCO/TRE) Date: Thu, 16 Jul 2015 10:43:22 +1200 Lines: 19 Message-ID: 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> <87k2u2eu67.fsf@elektro.pacujo.net> <55A51662.4090007@rece.vub.ac.be> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net COPL3OVji0Oi+rHQ3SViXAUlgPLdu2gFhxMQ3pT7t8q3fqMvEj Cancel-Lock: sha1:ex8zPDsW4pP4cp4tTUBI5pwGs3k= User-Agent: Mozilla Thunderbird 1.0.5 (Macintosh/20050711) X-Accept-Language: en-us, en In-Reply-To: Xref: csiph.com comp.lang.python:93886 Antoon Pardon wrote: > But it doesn't need to be all or nothing. How about the following possibility. > When the runtime detects a serie of tail calls, it will keep the bottom three > and the top three backtrace records of the serie. Whatever value you choose for N, keeping only the first/last N traceback frames will lead to someone tearing their hair out. I recently had an experience with some Java code running in an environment which believed that nobody would want to see more than about 30 traceback levels, and chopped the rest off. Of course, the information I desperately wanted was buried deeper than that... So, -1 on any arbitrarily chosen traceback cutoff. -- Greg