Tail recursion to while iteration in 2 easy steps
Terry Reedy
tjreedy at udel.edu
Fri Oct 4 17:14:55 EDT 2013
On 10/4/2013 6:46 AM, Ian Kelly wrote:
> On the other hand, if you start optimizing every tail call and not
> just the recursive functions, then I can see where that could start to
> get problematic for debugging -- as arbitrary functions get removed
> from the stack traces just because they happened to end in tail calls.
The idea of CPython space-optimizing tail calls when the call is made
has been suggested on python-ideas. Guido verified that it is
technically possible with the current bytecode interpreter but rejected
it because it would arbitrarily mess up stack traces.
--
Terry Jan Reedy
More information about the Python-list
mailing list