Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #93837

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'cpython': 0.05; 'from:addr:yahoo.co.uk': 0.05; 'optimizing': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'url:github': 0.09; 'python': 0.10; 'stack': 0.13; 'syntax': 0.13; 'bytecode': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'recipe': 0.16; 'reedy': 0.16; 'user-defined': 0.16; 'wrote:': 0.16; 'mechanism': 0.18; 'language': 0.19; 'function,': 0.22; 'lawrence': 0.22; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'module': 0.25; "i've": 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'tail': 0.29; 'ago': 0.29; 'subject:/': 0.30; 'code': 0.30; 'included': 0.32; 'anybody': 0.32; 'language.': 0.32; 'add': 0.34; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'received:org': 0.37; 'to:addr:python.org': 0.40; 'mark': 0.40; 'ago.': 0.61; 'charset:windows-1252': 0.62; 'our': 0.64; 'direct': 0.68; 'decorator.': 0.84; 'pythonistas,': 0.84; 'thing,': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)
Date Wed, 15 Jul 2015 01:14:33 +0100
References <mailman.460.1436783918.3674.python-list@python.org> <lf5twt8mhec.fsf@ling.helsinki.fi> <mo1f4q$3fa$1@ger.gmane.org> <mo46l7$3nd$1@ger.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host host-78-147-20-120.as13285.net
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
In-Reply-To <mo46l7$3nd$1@ger.gmane.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.517.1436919290.3674.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1436919290 news.xs4all.nl 2893 [2001:888:2000:d::a6]:35625
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:93837

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE) Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-07-13 14:22 +0300
  Re: Possibly Pythonic Tail Call Optimization (TCO/TRE) Chris Angelico <rosuav@gmail.com> - 2015-07-13 21:47 +1000
  Re: Possibly Pythonic Tail Call Optimization (TCO/TRE) Terry Reedy <tjreedy@udel.edu> - 2015-07-13 18:46 -0400
  Re: Possibly Pythonic Tail Call Optimization (TCO/TRE) Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-15 00:40 +0100
  Re: Possibly Pythonic Tail Call Optimization (TCO/TRE) Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-15 01:14 +0100

csiph-web