A new module for performing tail-call elimination
greg.ewing at canterbury.ac.nz
Sun Jul 19 00:39:29 CEST 2015
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
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.
Using a dedicated keyword would make it clear that tail
call behaviour is being relied upon, and avoid looking
like a spurious return.
More information about the Python-list