Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: Possibly Pythonic Tail Call Optimization (TCO/TRE) Date: Wed, 15 Jul 2015 17:55:26 +0300 Organization: A noiseless patient Spider Lines: 14 Message-ID: <87vbdlbhcx.fsf@elektro.pacujo.net> References: <55A3A853.4040006@rece.vub.ac.be> <55A3C366.6060602@rece.vub.ac.be> <87fv4r1fre.fsf@jester.gateway.sonic.net> <877fq3nuwo.fsf@elektro.pacujo.net> <87pp3vm93f.fsf@elektro.pacujo.net> <87d1zuejk2.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="b7cb1518d23ec19d482dcc9c31d30fdd"; logging-data="31008"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/czqKQ79xAMWRi3DO+gQNf" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:lcpT42/5hxRbWQlDw2Ac/yGcFmQ= sha1:/CXjRNqw6nEkQF/Ib2CsOjF47fo= Xref: csiph.com comp.lang.python:93874 Ian Kelly : > On Tue, Jul 14, 2015 at 11:27 AM, Marko Rauhamaa wrote: >> You'll see that the generated code is tail-call-optimized. > > This can't be done generally, though. What if, instead of a local > variable, the assignment were to a dict item? Even if the dict itself > is a local variable, the assignment can't be optimized away. Of course, you can only do correct optimizations. My point is that tail call optimizations should not be micromanaged by the programmer. Marko