A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-October/074920.html below:

[Python-Dev] Explicit Tail Calls

[Python-Dev] Explicit Tail CallsGreg Ewing greg.ewing at canterbury.ac.nz
Sat Oct 13 11:19:43 CEST 2007
Shane Hathaway wrote:

> I was aware of Guido's earlier rejections, but I figured the rejection
> was due to the risky implicit optimization proposed by others.  Perhaps
> the objection is deeper than that; I suspect Guido specifically objects
> to excessive use of recursion.

As I recall, one of the objections is that it makes
debugging difficult by removing intermediate stack
frames from the traceback.

However, I don't think that the sort of programming
style that requires tail call optimisation is really
part of the Python programming culture. It's used
in languages like Lisp and Haskell because the data
structures used to represent lists in those languages
are themselves recursive.

However, Python doesn't do things that way -- normally
it represents a list as a flat data structure, which
is more naturally iterated over than recursed over.

In my experience, the only time recursion is really
called for in Python is when you're operating on
tree-shaped data structures, in which case tail calls
don't really come into it.

When operating on something linear, I find that
a for-loop or list comprehension usually gets the
job done more clearly and concisely.

--
Greg

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4