[Python-ideas] Tail Call Optimization (was Re: Tail recursion elimination)
musicdenotation at gmail.com
musicdenotation at gmail.com
Sun Jan 19 23:32:30 CET 2014
>> On Jan 19, 2014, at 19:31, Nick Coghlan <ncoghlan at gmail.com> wrote:
>>
>> On 19 January 2014 22:12, Terry Reedy <tjreedy at udel.edu> wrote:
>> TCO (Tail Call Optimization) means that when TCO is in effect and a tail
>> call "return f(<args>)" is executed, the current execution context (stack
>> frame) is used for the call instead of allocating a new one. What is
>> 'optimized' is space usage. The effect on time is not clear.
>>
>>> On 1/18/2014 7:45 PM, Steven D'Aprano wrote:
>>>
>>> What makes you say that it is "non-pythonic"? You seem to be assuming
>>> that *by definition* anything written recursively is non-pythonic. I do
>>> not subscribe to that view.
>>
>>
>> Neither do I.
>
> Guido is on record as preferring iterative algorithms as more
> comprehensible for more people, and explicitly opposed to adding tail
> call optimisation. I tend to agree with him - functional programming
> works OK in the small (and pure functions are a fine tool for managing
> complexity), but to scale up in a way that fits people's brains, you
> need to start writing code that looks more like a cookbook.
>
> If you want inspiration on how to design a language for typical human
> thought patterns, look to cookbooks, training guides and operator
> manuals, not mathematics.
>
> Nick
>
> --
> Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
See this:
http://www.stanford.edu/class/cs242/readings/backus.pdf
It fits peoples' brains more because of familiarity, not "nature". While procedures in a guide (cookbook, user manual,...) are better written imperatively because of the way things are done (so are user interfaces), the behind-the-scenes algorithms have no single "intuitive" way to write that applies for all cases. They are written imperatively because of performance (and later, familiarity).
Poor support for functional programming + Global Interpreter Lock = Outdated language.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140120/81aebfbe/attachment.html>
More information about the Python-ideas
mailing list