Iterative vs. Recursive coding

Aahz aahz at
Mon Sep 6 18:17:32 CEST 2010

In article <4c70344a$0$1659$742ec2ed at>,
John Nagle  <nagle at> wrote:
>    Realistically, recursion isn't that important in Python.  It's
>there if you need it, and sometimes useful, but generally not used
>much without good reason.  In some functional languages, recursion
>is routinely used in place of iteration, but Python isn't built for
>that.  In Python, most of the use cases for trivial recursion
>are better handled with iteration or generators.

Depends how you define "important".  It's certainly a critical feature
for Python that you *can* use recursion; it's usually the simplest way of
walking a tree structure (such as a directory tree).  Python would be an
extraordinarily limited language if recursion were not available.
Aahz (aahz at           <*>

"...if I were on life-support, I'd rather have it run by a Gameboy than a
Windows box."  --Cliff Wells

More information about the Python-list mailing list