Possibly Pythonic Tail Call Optimization (TCO/TRE)

Gregory Ewing greg.ewing at canterbury.ac.nz
Wed Jul 15 18:43:22 EDT 2015


Antoon Pardon wrote:
> But it doesn't need to be all or nothing. How about the following possibility.
> When the runtime detects a serie of tail calls, it will keep the bottom three
> and the top three backtrace records of the serie.

Whatever value you choose for N, keeping only the
first/last N traceback frames will lead to someone
tearing their hair out.

I recently had an experience with some Java code
running in an environment which believed that nobody
would want to see more than about 30 traceback levels,
and chopped the rest off. Of course, the information
I desperately wanted was buried deeper than that...

So, -1 on any arbitrarily chosen traceback cutoff.

-- 
Greg



More information about the Python-list mailing list