Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #55383
| References | <l2feu0$n61$1@ger.gmane.org> <1380717085.6985.29063445.6AD889D5@webmail.messagingengine.com> |
|---|---|
| Date | 2013-10-02 14:39 -0700 |
| Subject | Re: Tail recursion to while iteration in 2 easy steps |
| From | Mark Janssen <dreamingforward@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.653.1380749987.18130.python-list@python.org> (permalink) |
>> 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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Tail recursion to while iteration in 2 easy steps Mark Janssen <dreamingforward@gmail.com> - 2013-10-02 14:39 -0700
csiph-web