Possibly Pythonic Tail Call Optimization (TCO/TRE)

Marko Rauhamaa marko at pacujo.net
Tue Jul 14 10:33:56 CEST 2015

Ian Kelly <ian.g.kelly at gmail.com>:

> On Mon, Jul 13, 2015 at 11:57 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
>> How about "return"?
> I think you miss my point entirely. "return" doesn't mean tail-call
> optimize;

Why not?

> it just means to return the result.

Same difference.

> This is what led to the confusion responsible for the bug that Chris
> pointed out in the first place. With a keyword that explicitly means
> "perform tail-call optimization *and* return",

That could well be the explicit definition of the "return" statement in
Python without changing the behavior of any working Python program

> the association of the keyword with the optimization is much clearer,
> and the programmer is much less likely to mistakenly omit it.

The programmer shouldn't be controlling tail call optimizations.


More information about the Python-list mailing list