[Python-Dev] Re: Proper tail recursion

Andrew Koenig ark-mlist at att.net
Fri Jul 16 16:18:20 CEST 2004


> Where the recursion limit really bites me is the inability to do
> recursive depth first search on big graphs.  Of course, I can simulate
> the stack myself and write the rest iteratively, but if I wanted to do
> that I'd go back to writing in assembly language.

+1.

If you think you don't care about recursive depth-first searches on big
graphs, think again: Pickling is an example of such an algorithm.  I haven't
looked at how it's actually implemented, but it seems to me that either the
implementation must simulate recursion manually or it will fail on linked
data structures that are bigger than the recursion limit.  Even if the
standard library takes care to avoid unbounded recursion, anyone else who
wants to traverse data structures in similar ways faces similar problems.



More information about the Python-Dev mailing list