A new module for performing tail-call elimination

Mark Lawrence breamoreboy at yahoo.co.uk
Sun Jul 19 02:09:49 CEST 2015


On 18/07/2015 23:39, Gregory Ewing wrote:
> Marko Rauhamaa wrote:
>> At any rate, it demonstrates how the idiom has its place in Python.
>
> Perhaps it does, but I think I'd still prefer it to be
> explicit.
>
> The call in Marko's example is not actually a tail call
> as written. To make it a tail call, a return would need
> to be added:
>
>  >       return child.setvalue(keyseq, value, offset + 1)
>
> To someone reading the code, it's not obvious why the
> return is there. It looks redundant, and is likely to
> get removed by someone who thinks it's a mistake.

A time to use perhaps the most abused part of any programming language, 
a comment?

>
> Using a dedicated keyword would make it clear that tail
> call behaviour is being relied upon, and avoid looking
> like a spurious return.
>

+1

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Python-list mailing list