Python is not bad ;-)

Marko Rauhamaa marko at pacujo.net
Sat May 2 05:58:37 EDT 2015


Chris Angelico <rosuav at gmail.com>:

> 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.


Marko



More information about the Python-list mailing list