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
participants (1)
-
Greg Ewing