Possibly Pythonic Tail Call Optimization (TCO/TRE)
marko at pacujo.net
Wed Jul 15 08:44:42 CEST 2015
Gregory Ewing <greg.ewing at canterbury.ac.nz>:
> Marko Rauhamaa wrote:
>> It might even be tail-call optimized by Python. Only you can't count
>> on it because the language spec doesn't guarantee it.
> The language spec might permit it, but the BDFL has explicitly
> expressed a dislike for the idea of implicit tail call removal, so
> it's unlikely to ever happen in CPython.
Permitting wouldn't be enough.
The other problem for tail call elimination is the requirement that
functions return None by default. Smooth tail call elimination would
require that Python leave the default return value unspecified.
More information about the Python-list