Iteration over recursion?

Jon Clements joncle at
Tue Jun 20 21:02:59 CEST 2006

Sudden Disruption wrote:

> Bruno,
> > It doesn't. Technical possible, but BDFL's decision...
> Sure.  But why bother?

I agree.

> Anything that can be done with recursion can be done with iteration.
> Turng proved that in 1936.
> Recursion was just an attempt to "unify" design approach by abstracting
> itteration and creating a new context.  It allowed the programmer to
> isolate himself from the reality that he was actually iterating.  Talk
> about mind fuck.

Well, unless I'm seriously mistaken, it also breaks good design. If a
function calls another function, it's because it requires that
function's specific service. If the service it requires is itself, then
the function should iterate over a set of data and  accumulate/reduce
or whatever else it needs to do. As well as that, I can imagine
exception handling becoming quite cumbersome/clumsy.

> It seems things were just to simple the way they were.
> Like all fashion, this too shall pass.

Be great if it does; but I don't imagine this will happen until
examples of traversing a binary tree using recursion disappear from
computer science text books (the ones I have seen anyway...).  Unless,
later in the course (they might do this, I don't know for sure), they
then say, "BTW people, this is the correct way to do it, because the
previous way isn't too good an idea...".

> Sudden Disruption
> --
> Sudden View...
>     the radical option for editing text

Just my little rant,


More information about the Python-list mailing list