[Python-Dev] Proper tail recursion (original) (raw)

Michael Walter michael.walter at gmail.com
Wed Jul 14 20:46:29 CEST 2004


I think it's pretty cool as it gives the programmer more freetime to use "functional style".

Cheers, Michael

On Wed, 14 Jul 2004 19:45:01 +0100, Michael Hudson <mwh at python.net> wrote:

Christopher T King <squirrel at WPI.EDU> writes:

> JanC recommended I post this on python-dev to get feedback. To sum > up the previous posts in my thread on comp.lang.python, I've created > a patch that optimizes tail calls in the CPython interpreter, so > that the stack is not used for functions called in a tail context. I guess I could have said this in c.l.py, but: what's the point? I don't think I've ever had a situation where hitting the recursion limit wasn't a bug, and given a) the ease with which a non-contrivedly tail recursive algorithm can usually be rewritten iteratively and b) the (lack of) speed of function calls in today's Python I can't see any huge real advantage to this patch. It's a cute hack though :-) Cheers, mwh -- if-you-need-your-own-xxx.py-you-know-where-to-shove-it-ly y'rs - tim -- Tim Peters dishes out versioning advice on python-dev


Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/michael.walter%40gmail.com



More information about the Python-Dev mailing list