On Mon, Jul 13, 2015 at 6:34 AM, Chris Angelico <ros...@gmail.com> wrote: > On Mon, Jul 13, 2015 at 10:00 PM, Antoon Pardon > <antoon.par...@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. -- https://mail.python.org/mailman/listinfo/python-list