FOR statement

Theerasak Photha hanumizzle at gmail.com
Sat Oct 21 10:40:34 CEST 2006


On 21 Oct 2006 01:31:55 -0700, bearophileHUGS at lycos.com
<bearophileHUGS at lycos.com> wrote:
> Theerasak Photha:
> > I guess Python isn't tail-recursive then?
>
> Right.
>
>
> > Well, algorithms seem to be more naturally expressed iteratively in
> > Python, and to be fair, most uses of recursion you see in e.g., Scheme
> > textbooks are really just grandstanding in the real world.
>
> Still, some algorithms enjoy some recursivity anyway, like some graph
> or tree exploration, structure flattening, and so on, for them I
> sometimes use recursivity in Python too.

That's absolutely true. However, it is probably unusual in most
circumstances for such recursions to blow through more than a thousand
stack frames.

-- Theerasak



More information about the Python-list mailing list