[Python-Dev] Proper tail recursion (original) (raw)

Tim Peters tim.peters at gmail.com
Fri Jul 16 00:01:25 CEST 2004


[Jeremy Hylton]

... Getting a useful traceback after tail call optimization seems like an awfully important quality of implementation issue.

Indeed, in delegation-heavy designs, when an error occurs the delegation path you took to reach the failing code often is "the error".

So let's optimize tail calls, but for each elided one we'll allocate a record containing a pointer to its caller, the line number of the optimized tail call, and the bindings of locals. It will look pretty much exactly like a frame object looks today, but we won't call it a frame object, and then everyone will be happy .



More information about the Python-Dev mailing list