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


Groups > comp.lang.python > #55383 > unrolled thread

Re: Tail recursion to while iteration in 2 easy steps

Started byMark Janssen <dreamingforward@gmail.com>
First post2013-10-02 14:39 -0700
Last post2013-10-02 14:39 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Tail recursion to while iteration in 2 easy steps Mark Janssen <dreamingforward@gmail.com> - 2013-10-02 14:39 -0700

#55383 — Re: Tail recursion to while iteration in 2 easy steps

FromMark Janssen <dreamingforward@gmail.com>
Date2013-10-02 14:39 -0700
SubjectRe: Tail recursion to while iteration in 2 easy steps
Message-ID<mailman.653.1380749987.18130.python-list@python.org>
>> Part of the reason that Python does not do tail call optimization is
>> that turning tail recursion into while iteration is almost trivial, once
>> you know the secret of the two easy steps. Here it is.
>
> That should be a reason it _does_ do it - saying people should rewrite
> their functions with loops means declaring that Python is not really a
> multi-paradigm programming language but rather rejects functional
> programming styles in favor of imperative ones.

Yes, but that's fine.  A PL language that includes every programming
paradigm would be a total mess, if even possible.  Python has
functional programming where it does not conflict with its overall
design.  The only place I find that this is not the case is with
lambda, but that is now adequately fixed with the addition of the
ternary operator.

-- 
MarkJ
Tacoma, Washington

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web