[Python-Dev] Re: Proper tail recursion

Josiah Carlson jcarlson at uci.edu
Fri Jul 16 20:23:46 CEST 2004


On Fri, 16 Jul 2004 14:03:25 -0400, "Phillip J. Eby" <pje at telecommunity.com> wrote:
> At 10:45 AM 7/16/04 -0700, Josiah Carlson wrote:
> >IMO it shouldn't be only about tail-call optimizations.  Andrew Koenig
> >suggested that frames be allocated from the heap, which if it is
> >possible (is there anything that gets executed directly by the processor
> >so we have to worry about processors supporting NX?), seems to remove
> >the C stack limit.
> 
> Frames *are* allocated on the heap.  That's not the problem.  The problem 
> is that the interpreter *has* to use the C stack to call C functions, and 
> Python objects are implemented using C functions.  Therefore, invoking 
> operations on Python objects uses the C stack, in the general case.

Ahh, now I understand.  Thank you for the clarification.  I'll go back
to lurking now.

 - Josiah



More information about the Python-Dev mailing list