Possibly Pythonic Tail Call Optimization (TCO/TRE)

Antoon Pardon antoon.pardon at rece.vub.ac.be
Tue Jul 14 12:43:05 CEST 2015

On 07/14/2015 10:34 AM, Ian Kelly wrote:
> On Tue, Jul 14, 2015 at 1:26 AM, Antoon Pardon
> <antoon.pardon at rece.vub.ac.be> wrote:
>> I expect any example given, to be used as a contest by those reading,
>> for finding
>> the least warped alternative and then using that to dismiss the example.
>> So I really don't feel compelled to search through my code in the hope
>> of finding
>> an example that would persuade someone.
> And yet, Python somehow manages to gain new features with each release.

Sure, but what happens in this list, has an insignificant role in
driving that process.

> The reason why most proposals get rejected is because most proposals
> are bad. If every idea that came along just got accepted, we'd have a
> disastrous hodge-podge of a language.

But I'm not proposing TCO to be accepted. I was just pointing out
a reason for preferring it in particular circumstances and only
because some people here suggested there could be no such reasons.

> In the case of TCO, Guido rejected the feature six years ago and
> hasn't shown any sign of changing his mind. He considered the
> arguments for it, and he decided that for Python, the benefits don't
> outweigh the drawbacks. Maybe his mind could still be changed, but
> it's going to take somebody to make a very convincing case for the
> feature, and if you're not even willing to put forth some examples
> then you don't have a case at all.

Indeed I am not trying to make a case. I was just protesting the
sugestion that there are no circumstances in which having TCO could
be an advantage. That me suggesting such circumstances do exist
gets turned into me trying to make a case for including TCO into
the language is one important reason why I am not inclined to search
for examples. Because all I would try to do is illustrate how TCO
would be an advantage in that case en how it would probably be received
is as if I would try and present that example as a compelling case for
introducing TCO into python.

For what it is worth, in general I find both the warping necessary for
turning iterative code into tail-recursive code and vice versa not
that big a deal. I just find that the solutions for my problems are
sometimes more easily expressed one way and sometimes the other way
and I would prefer I didn't need to warp.

More information about the Python-list mailing list