[Tutor] string.replace

Ignacio Vazquez-Abrams ignacio@openservices.net
Wed, 12 Sep 2001 00:56:14 -0400 (EDT)


> The recursive striptabs() call is buggy, but's also intentionally
> recursive: if Jon changes the line from:
>
>  		striptabs(line)
>
> to:
>
>                 line = striptabs(line)
>
> and corrects a few more logical bugs, the code should work because
> striptabs should only call itself recursivly if the line still contains
> tags --- his use of recursion is about the same as if he had used an
> explicit while loop.

That's true, but 95-97% of the time iterative constructs are faster than
recursive mechanisms, plus by definition they don't cause recursion overflows.
Both of those points can be a big advantage if very large documents are being
processed.

-- 
Ignacio Vazquez-Abrams  <ignacio@openservices.net>