[Python-Dev] [ python-Patches-876206 ] scary frame speed hacks (original) (raw)

Dennis Allison allison at sumeru.stanford.EDU
Tue Mar 2 12:24:10 EST 2004


Josiah,

Since "any recursiton can be made iterative", would you support removing recursion from Python (-:

Recursion is a natural way to program many things, particularly in Python.
I believe it's a bad design choice to penalize recursive functions. On the other hand, specializing the code for non-recurive functions is appealing--so, keep the free list and add the pre-built frame and bite the bullet on complexity per Guido's comment.

On Tue, 2 Mar 2004, Josiah Carlson wrote:

> I would be cautious about anything that slows recursive functions becasue > almost any interesting data structure traversal is recursive.

Any recursion can be made iterative. Sure, it can be a pain to do, but it is always a good exercise. See this thread for a generic and involved example: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&safe=off&th=d04dcc083dc6d219&rnum=1 hierCodeTreePanel.newheirarchy in the PyPE source code (pype.sourceforge.net) also has an example.



More information about the Python-Dev mailing list