Recursive update of arbitrarily nested dicts

Justin Sheehy justin at iago.org
Sat Dec 15 15:16:11 EST 2001


Ype Kingma <ykingma at accessforall.nl> writes:

> Compilers can do nice things to simplify tail recursion to a loop.
> (I wonder whether there is such a compiler for python already.)

Neither of the two major implementations (CPython, Jython) performs
tail call elimination.

As much as I would love to have such optimizations available to me in
Python, it does not often end up mattering in practice.

(With Python, that is.  Tail call elimination matters much more when
using languages where the predominant programming style is closer to
being purely functional.)

It is generally not hard to take a tail-recursive function and rewrite
it by hand into an iterative one, performing this optimization at the
programmer instead of the compiler in the few cases where it really matters.

-Justin

 





More information about the Python-list mailing list