Tail recursion to while iteration in 2 easy steps
Antoon Pardon
antoon.pardon at rece.vub.ac.be
Sat Oct 5 03:39:40 EDT 2013
Op 04-10-13 23:14, Terry Reedy schreef:
> 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.
What does this mean?
Does it mean that a naive implementation would arbitrarily mess up
stack traces and he wasn't interested in investigating more
sophisticated implementations?
Does it mean he just didn't like the idea a stack trace wouldn't be a
100% represenatation of the active call history?
Does it mean he investigated more sphisticated implementations but found
them to have serious short comings that couldn't be remedied easily?
--
Antoon Pardon
More information about the Python-list
mailing list