Possibly Pythonic Tail Call Optimization (TCO/TRE)

Gregory Ewing greg.ewing at canterbury.ac.nz
Wed Jul 15 11:13:00 CEST 2015

Chris Angelico wrote:
> I'm still interested in the explicit "replace current stack frame with
> this call" operation. Calling it "goto" seems wrong, as most languages
> with goto restrict it to _within_ a function,

This just suggests to me is that most language designers
are not very imaginative. :-)

A tail call *is* a goto. That's how you implement one in
assembly language -- you write a jump instruction instead
of a call instruction. The jump doesn't have to be to
the same function.

Also see:



More information about the Python-list mailing list