[Python-ideas] A Continuations Compromise in Python

Greg Ewing greg.ewing at canterbury.ac.nz
Sun May 3 10:30:54 CEST 2009


Steven D'Aprano wrote:

> It's hardly "premature" to notice that recursive code in Python is 
> significantly slower and less efficient than in other languages. This 
> is a known problem, or at least issue, since some people consider that 
> the solution (tail-recursion optimization) is worse that the problem.

It's also by no means certain that TCO would provide the
kind of speed benefit that people imagine. A lot of the
overhead of making a Python function call is concerned
with packing up the arguments and unpacking them again,
which you still need to do even if you're reusing the
stack frame.

-- 
Greg



More information about the Python-ideas mailing list