[Python-Dev] Proper tail recursion
Guido van Rossum
guido at python.org
Fri Jul 16 04:21:00 CEST 2004
> > > How about: Tail recursion "enables" recursion-oriented (functional)
> > > style? :)
> > Still -1. I was understating my case: I find the "recursion is the
> > basis of everything" attitude harmful.
> I think it's still best to "enable" such a style in some cases --
> Python's syntax is designed to allow formulation of a problem in the
> most natural way. Sometimes it's more natural to formulate a
> problem as a recursive function than a procedural one, but the
> current implementation restricts this.
> I agree that "recursion is the basis of everything" is harmful, but
> I think the same belief can apply to "procedularism is the basis of
> everything" (why do we have classes, list comprehensions, etc.?).
> Some things are better formulated in a procedural style, while
> others are better formulated in a recursive style.
And how should we decide whether something is better done without
recursion? I currently have an easy answer: if it exceeds the
stack limit, you're probably spending too much time on function
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev