Python is not bad ;-)

Chris Angelico rosuav at gmail.com
Sat May 2 05:25:11 EDT 2015


On Sat, May 2, 2015 at 7:10 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Note: Scheme is my favorite language and I use tail recursion all the
> time. I also think eliminating tail recursion is such a low-hanging
> fruit that even CPython should just pick it. However, I wouldn't use the
> fibonacci sequence to justify anything at all about a programming
> language.

Actually, it isn't such low-hanging fruit. As has been mentioned in
this thread already, Guido is against anything that disrupts
tracebacks, and optimizing tail recursion while maintaining traceback
integrity is rather harder.

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.

ChrisA



More information about the Python-list mailing list