Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.kamp.net!newsfeed.kamp.net!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: Fri, 17 Jul 2015 10:41:40 +1200 Lines: 37 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 p537VfoIZucNZXlmMO0rYQ4TMgRcsu8dBj4GrVlTgfiIOtexMl Cancel-Lock: sha1:WL7HsBh3iNzPRP/EXICQX6T4Fqc= User-Agent: Mozilla Thunderbird 1.0.5 (Macintosh/20050711) X-Accept-Language: en-us, en In-Reply-To: Xref: csiph.com comp.lang.python:93968 Antoon Pardon wrote: > On 07/16/2015 12:43 AM, Gregory Ewing wrote: > >>Whatever value you choose for N, keeping only the >>first/last N traceback frames will lead to someone >>tearing their hair out. > > I would say, that someone should get over himself. > Traceback are not the only or even the most useful > tool for debugging code. They're the one thing I miss the most whenever I have to debug something in an environment that doesn't provide them, though, > My experience is, that if you need to dig that deep > in a stack trace, to find the information you need, you > get it easier and faster by turning debug level logging > on and going through the logs. YMMV. That only helps if the code logs the information you need or can be easily modified to do so. In my case, it didn't and couldn't. > I also have to wonder, In my suggestion you would only start > to loose traceback records after six consecutive tail calls. > That IMO strongly suggest a loop. Not necessarily. Chains of calls very often go more than 6 levels deep. It's less likely that they would all happen to be tail calls, but it could happen without there being any looping or recursion involved. And the source of the problem you're trying to debug could be in *any* of the intermediate calls, not necessarily the first or last 3. -- Greg