Python is not bad ;-)

Marko Rauhamaa marko at pacujo.net
Sat May 2 05:10:52 EDT 2015


Cecil Westerhof <Cecil at decebal.nl>:
> I find factorial a lot cleaner code as factorial_iterative, so here
> tail recursion would be beneficial.

I would just call math.factorial() and be done with it.

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.

It's not about performance (that's rarely a very useful argument when it
comes to Python). It's only that every now and then a very natural tail
recursion crops up and it's just silly to have to refactor perfectly
good code because of a stack overflow.


Marko



More information about the Python-list mailing list