Recursively traverse linked list -- help!

Paul Rubin phr-n2002a at nightsong.com
Thu Feb 21 14:28:36 EST 2002


"Jason Orendorff" <jason at jorendorff.com> writes:
> Here is how it might work.  Python could create a new frame.
> The optimization is that the frame performing the tail call can be
> culled right away, saving some memory and shortening the stack.
> The culled frame would disappear from traceback information too,
> unfortunately.
> 
> I'm sure this has been discussed endlessly before.

I don't think it's important for Python to do tail call optimization,
as long as users know better than to code in tail recursive style.
Only some Scheme-heads actually think that way most of the time, and
they generally understand the issues well enough to not do it in Python.

I do sometimes think about how to interpret Python using a Scheme
evaluator, but the answers aren't pretty.



More information about the Python-list mailing list