Iterative vs. Recursive coding

John Nagle nagle at animats.com
Sun Aug 22 15:36:22 EDT 2010


On 8/21/2010 8:32 PM, Steven D'Aprano wrote:
> On Sat, 21 Aug 2010 19:09:52 -0500, John Bokma wrote:
>
>> this means that Python should eliminate / optimize tail
>> recursion.
>
> There have been various suggestions to add tail recursion optimization to
> the language. Two problems:
>
>
> * It throws away information from tracebacks if the recursive function
> fails; and
>
> * nobody willing to do the work is willing to champion it sufficiently to
> get it approved in the face of opposition due to the above.

    I would rank tail recursion way down on the list of things which
make CPython slow.

    (Unladen Swallow seems to have stalled.  Last quarterly release,
October 2009.  Last wiki update, May 2010.  Last issue advanced
to "started" state, Feb. 2010.  There are still code checkins,
so somebody is still working, but little visible progress.
They did get a JIT working, but discovered that the performance
improvement was very slight.  They wanted at least 5x; they got
1x to 2x at best.)

				John Nagle



More information about the Python-list mailing list