Why no tailcall-optimization?

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Tue Sep 23 03:06:17 EDT 2008


process a écrit :
> Why doesn't Python optimize tailcalls? 

Design choice. tail-recursive calls optimization makes debugging harder. 
Note that this has been discussed quite a few times here.

> Are there plans for it?
> 
> I know GvR dislikes some of the functional additions like reduce and
> Python is supposedly about "one preferrable way of doing things" but
> not being able to use recursion properly is just a big pain in the
> a**.

While it has some (limited) support for functional idioms, Python is 
still mostly an imperative language, and as such favors iteration over 
recursion. Not being able to do XXX is only a PITA if you know no other 
way to skin the cat.

NB : FWIW, I'd personnally prefer to have tail-recursive calls 
optimization too - but not badly enough to switch to another language...




More information about the Python-list mailing list