[Python-ideas] Tail Call Optimization (was Re: Tail recursion elimination)

Steven D'Aprano steve at pearwood.info
Mon Jan 20 01:23:22 CET 2014


On Sun, Jan 19, 2014 at 07:12:16AM -0500, Terry Reedy wrote:

> Are you willing to do any of the work needed to make the option 
> available, starting with a specification? If so, I have some ideas.

Given the amount of controversy over this, it would probably need a PEP. 
I might be able to start with a pre-PEP, time permitting, and see how 
that goes. (If those interminable bytes/unicode/2.8 threads on the 
Python-Dev list would start to die off, I might have more time to treat 
this seriously.)


> >Having to fork the entire compiler just to write a few functions in
> >their most idiomatic, natural (recursive) form seems a bit extreme,
> >wouldn't you say?
> 
> A 'fork' could consist of a relatively small patch that could be 
> uploaded to, for instance, PyPI. I would not be surprised if 100-200 
> lines might be enough.

Lines of *C* though, right? Which means for anyone to use it, they would 
have to be willing to build Python from source, applying your patch, or 
the maintainer would have to volunteer to provide pre-built binaries. 
Neither of which is exactly a recipe for broad take-up.


-- 
Steven


More information about the Python-ideas mailing list