Possibly Pythonic Tail Call Optimization (TCO/TRE)

Antoon Pardon antoon.pardon at rece.vub.ac.be
Tue Jul 14 03:26:57 EDT 2015


On 07/14/2015 05:20 AM, Steven D'Aprano wrote:
> On Tue, 14 Jul 2015 12:05 am, Chris Angelico wrote:
>
>> If you want to make an assertion that iterative
>> code requires equivalent warping to tail-recursive code, I want to see
>> an example of it. Is that difficult?
> Of course it is. If it wasn't difficult, people would post examples instead
> of getting all defensive about being asked for examples.

Shrug! I have seen this game played before. It has been played since before
python had an if-expression. It always goes as follows. Some one mentions
a feature python doesn't has and that could be useful. The python status-quo
people will argue that it is unnecessary. Any example that will be given
to illustrate the advantage will be nit picked appart for any possible flaw,
while mostly ignoring the flaws in the status quo.

Before python had an if-expression, examples were asked too and they
convinced
noone. It wasn't until a core developer was bitten by an elusive bug, caused
by using the then advised "and or" combination, that python got an
if-expression
and that an if-expression was considered useful by the python community
in general.

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.

-- 
Antoon Pardon



More information about the Python-list mailing list