[Python-ideas] A Continuations Compromise in Python

Greg Ewing greg.ewing at canterbury.ac.nz
Mon May 4 02:30:25 CEST 2009


Gerald Britton wrote:

> It's also about being able
> to code a solution using recursion without worrying about the stack.
> The execution time may or may not change but the Python source may be
> easier to read using recursion instead of iteration.

Stack space is only an issue if you're using
recursion to traverse a linear data structure.
If the structure is tree-shaped, you'll run out
of memory for the tree long before it's deep
enough to cause stack problems.

I've yet to see a Python function operating on a
linear structure that was easier to follow using
recursion instead of iteration.

-- 
Greg



More information about the Python-ideas mailing list