On Mon, Jul 13, 2015 at 11:57 PM, Marko Rauhamaa <ma...@pacujo.net> wrote:
> Ian Kelly <ian.g.ke...@gmail.com>:
>
>> On Mon, Jul 13, 2015 at 11:25 PM, Chris Angelico <ros...@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.
>
> How about "return"?

I think you miss my point entirely. "return" doesn't mean tail-call
optimize; it just means to return the result. This is what led to the
confusion responsible for the bug that Chris pointed out in the first
place. With a keyword that explicitly means "perform tail-call
optimization *and* return", the association of the keyword with the
optimization is much clearer, and the programmer is much less likely
to mistakenly omit it.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to