steven at REMOVE.THIS.cybersource.com.au
Tue May 5 04:46:41 EDT 2009
On Tue, 05 May 2009 01:25:49 -0700, Carl Banks wrote:
> *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).
You overstated your position, and then instead of gracefully admitting
that you overstated it, you're trying to weasel out of it by acting the
victim. If all you had said was that "sometimes" recursion should be
avoided, then who could argue against that? Scheme purists? Pah, this is
Python, we don't need no stinkin' mathematical purity!
Practicality beats purity is *precisely* why sometimes you need recursion
instead of forcing a complicated iterative solution onto a simple
> 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.
Or when the recursive algorithm is simpler than the iterative algorithm,
and you don't care about squeezing out every last tiny micro-optimization
into the code.
More information about the Python-list