Review, suggestion etc?

Joe Pfeiffer pfeiffer at cs.nmsu.edu
Fri Dec 18 11:12:11 EST 2020


Grant Edwards <grant.b.edwards at gmail.com> writes:


> On 2020-12-18, Joe Pfeiffer <pfeiffer at cs.nmsu.edu> wrote:
>
>> Recursion has very limited application, but where it's the right
>> tool it's invaluable (top-down parsers, some graph algorithms...).
>> We teach it primarily because by the time a student has a good
>> handle on how to write a recursive function they understand
>> functions in general really well.
>
> Yep, there are definitly cases where it's pretty much the only right
> answer. If you try to avoid it, you end up writing what turns into a
> simulation of recursion -- and doing that correctly isn't easy.

Decades ago I had to write a binary tree search in FORTRAN IV.  It
wasn't pretty.


More information about the Python-list mailing list