Possibly Pythonic Tail Call Optimization (TCO/TRE)
greg.ewing at canterbury.ac.nz
Tue Jul 14 08:29:12 CEST 2015
Marko Rauhamaa wrote:
> Ian Kelly <ian.g.kelly at gmail.com>:
>>Another point in favor of an explicit tail-call keyword. Then one
>>couldn't make that mistake.
> How about "return"?
How about "goto"? :-)
That's not entirely an unserious suggestion -- if you
really believe that a "goto with arguments" is a good
feature for a language to have, you shouldn't be
afraid to spell it as such.
def quicksort(array, start, end):
midp = partition(array, start, end)
if midp <= (start+end)//2:
quicksort(array, start, midp)
goto quicksort(array, midp+1, end)
quicksort(array, midp+1, end)
goto quicksort(array, start, midp)
More information about the Python-list