On 15/07/2015 00:40, Mark Lawrence wrote:
On 13/07/2015 23:46, Terry Reedy wrote:

Optimizing specific tail calls is tricker.  For one thing, calls to a
recursion-replacement function, such as recur, add a stack frame that
must also be popped. A CPython bytecode manimpuation solution was given
years ago as a recipe on the ActiveState Python Cookbook site.  MacroPy
at pypi.python.org "provides a mechanism for user-defined functions
(macros) to perform transformations on the abstract syntax tree(AST) of
Python code at module import time".  Among many included examples, it
has a tco decorator.


A direct link https://github.com/lihaoyi/macropy#tail-call-optimization
for anybody who is interested.


And I've just stumbled across this https://github.com/baruchel/tco which was only put up two days ago.

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to