Possibly Pythonic Tail Call Optimization (TCO/TRE)

Ian Kelly ian.g.kelly at gmail.com
Tue Jul 14 07:46:23 CEST 2015


On Mon, Jul 13, 2015 at 11:25 PM, Chris Angelico <rosuav at gmail.com> wrote:
> (Also, side point: Python can't actually optimize the above function,
> because it actually means "call quicksort, then discard its return
> value and return None". A true tail call has to return the result of
> the recursive call, and Python lacks a way to say "this function will
> always return None". But that's trivial.)

Another point in favor of an explicit tail-call keyword. Then one
couldn't make that mistake.


More information about the Python-list mailing list