On May 5, 12:51 am, Steven D'Aprano <ste...@remove.this.cybersource.com.au> wrote: > On Mon, 04 May 2009 23:09:25 -0700, Carl Banks wrote: > > In Python the One Obvious Way is iteration when possible, recursion when > > necessary. > > There's nothing "obvious" about solving the 8 Queens problem using > iteration. Or walking a binary tree. Or generating all the permutations > of a list.
*Sigh* Well, I'm out of this debate. Apparently it's not possible to argue that recursivie algorithms should be avoided *sometimes* without everyone citing cases that obviously aren't from those times (as if I had been arguing that recursion should be avoided all the time). Here's a parting thought for you to cite "counterexamples" of: Iteration should be used instead of recursion anywhere a tail- recursive algorithm is possible. Recursion should be used only when tail-recursion is not possible. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list