Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #93757 > unrolled thread
| Started by | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| First post | 2015-07-13 07:46 -0600 |
| Last post | 2015-07-13 07:46 -0600 |
| 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.
Re: Possibly Pythonic Tail Call Optimization (TCO/TRE) Ian Kelly <ian.g.kelly@gmail.com> - 2015-07-13 07:46 -0600
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2015-07-13 07:46 -0600 |
| Subject | Re: Possibly Pythonic Tail Call Optimization (TCO/TRE) |
| Message-ID | <mailman.465.1436795213.3674.python-list@python.org> |
On Mon, Jul 13, 2015 at 6:34 AM, Chris Angelico <rosuav@gmail.com> wrote: > On Mon, Jul 13, 2015 at 10:00 PM, Antoon Pardon > <antoon.pardon@rece.vub.ac.be> wrote: >> On 07/13/2015 01:28 PM, Chris Angelico wrote: >>> Why is it worth writing your code recursively, only to have it be >>> implemented iteratively? >> >> Because sometimes, it is easier to think about the problem recursively. > > Can you give me an example that (a) makes a lot more sense recursively > than iteratively, and (b) involves just one tail call? Why does (b) matter? If the function has more than one tail call, it doesn't matter which one you hit -- either way it's a tail call and the stack frame is no longer needed.
Back to top | Article view | comp.lang.python
csiph-web