On Thu, Apr 7, 2016 at 4:44 AM, Random832 <random...@fastmail.com> wrote:
> On Wed, Apr 6, 2016, at 14:23, Marko Rauhamaa wrote:
>> Chris Angelico <ros...@gmail.com>:
>>
>> > Plus, anyone could implement a Python interpreter with TCE.
>>
>> Tricky in practice because None is the default return value.
>>
>> If the programmer were careful to return the value of the tail call, it
>> can be eliminated.
>
> Well, the interpreter can know that the calling function doesn't return
> anything (returns None). Maybe it could pass a secret argument to the
> called function telling it not to return its value and to return None
> instead.

This is the exact sort of shenanigans that it takes to convert
recursion into tail recursion - and in MOST cases, it's very little
effort to go from there to explicit while loops. That's why TCE is so
infrequently important that it's just not worth the cost - which in
this case is damage to tracebacks.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to