process wrote:
Why doesn't Python optimize tailcalls? Are there plans for it?

I started to write an article on this but it disappeared....
So short answer:
1. Unless down very carefully, in a way that would slow things down, it would change the semantics of Python. 2. It is usually trivial to convert to a while loop, which amounts to in-frame recursion. If using tail-recursion requires a nested inner function to avoid repeating one-time initialization or exposing the cumulation variable, writing the loop is easier since no nested function is needed. 3. In Python, for loops are usually better for processing iterables, which covers most uses of induction (recursion/iteration).

Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to