Iterative vs. Recursive coding
Aahz
aahz at pythoncraft.com
Mon Sep 6 12:17:32 EDT 2010
In article <4c70344a$0$1659$742ec2ed at news.sonic.net>,
John Nagle <nagle at animats.com> 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 pythoncraft.com) <*> http://www.pythoncraft.com/
"...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