Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Christian Gollwitzer Newsgroups: comp.lang.python Subject: Re: Python is not bad ;-) Date: Sat, 02 May 2015 13:07:52 +0200 Organization: A noiseless patient Spider Lines: 29 Message-ID: References: <87mw1q9jqw.fsf@Equus.decebal.nl> <87383hj4zj.fsf@elektro.pacujo.net> <87d22lx38x.fsf@Equus.decebal.nl> <55432557$0$12994$c3e8da3$5496439d@news.astraweb.com> <87383fo062.fsf@Equus.decebal.nl> <87egmzl4yr.fsf@elektro.pacujo.net> <87a8xnl2r6.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 2 May 2015 11:06:49 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="09360e0ab07672f4bcf79b9f96c5414e"; logging-data="26201"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3Dp+4yc3ScQwASVGdQLiK+XgDxRCof40=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 In-Reply-To: <87a8xnl2r6.fsf@elektro.pacujo.net> Cancel-Lock: sha1:jaSm1P1vIX+cWc3LwL/Mg6jLRdo= Xref: csiph.com comp.lang.python:89762 Am 02.05.15 um 11:58 schrieb Marko Rauhamaa: > Chris Angelico : > >> Guido is against anything that disrupts tracebacks, and optimizing >> tail recursion while maintaining traceback integrity is rather harder. > > Tail recursion could be suppressed during debugging. Optimized code can > play all kinds of non-obvious tricks with the execution frame. > >> In the situations where it really is simple, you can always make the >> change in your own code anyway. Often, the process of converting >> recursion into tail recursion warps the code to the point where it's >> abusing recursion to implement iteration anyway, so just make it >> iterative. > > While you shouldn't actively replace Python iteration with recursion, I > strongly disagree that naturally occurring tail recursion is abuse or > should be avoided in any manner. Could you show me an example of naturally occuring tail recursion? I can't think of any. Or is it maybe one involving mutual recursion? I need to add, I grew up with imperative programming, and as such got recursion as the solution to problems that are too complex for iteration, i.e. tree traversal and such, and exactly these are never tail-recursive. Christian