Functional Programming and python

Tim Chase python.list at tim.thechases.com
Mon Sep 30 17:02:18 EDT 2013


On 2013-09-30 19:04, Franck Ditter wrote:
> two points make me crazy :
> 1. Tail recursion is not optimized. We are in 2013, why ? This is
> known technology (since 1960). And don't answer with "good
> programmers don't use recursion",

I seem to recall hearing that the primary reason it hadn't been
implemented is because of Python's super-dynamism (to make up a
word).  That a function could be a tail recursion in one call, but
the calling the same name could then become rebound.  I'm making up
the example, but I think it was something like this:

  def kablooie(*args):
    if not args:
      def kablooie(*args):
        woah()
    do_something(args)
    kablooie(args[1:])

where tail recursion optimization would do weird things.

-tkc





More information about the Python-list mailing list