Guido van Rossum wrote: >>>Tail Recursion ... > AFAIK Stackless only curtails the *C* stack, not the chain of Python > frames on the heap. Yup. > But I have a problem with tail recursion. It's generally requested by > new converts from the Scheme/Lisp or functional programming world, and > it usually means they haven't figured out yet how to write code > without using recursion for everything yet. IOW I'm doubtful on how > much of a difference it would make for real Python programs (which, > simplifying a bit, tend to use loops instead of recursion). And also > note that even if an exception is not caught, you'd like to see all > stack frames listed when the traceback is printed or when the debugger > is invoked. Same here. I'm not for automatic tail recursion detection. A very simple approach, also pretty easy to implement would be a "jump" property, which would be added to a function. It would simply allow to run a different (or the same) function than the current one without returning. def sort3(a, b, c): if a>b: return sort3.jump(b, a, c) if b>c: return sort3.jump(a, c, b) return a, b, c -- Christian Tismer :^) <mailto:tismer at tismer.com> Mission Impossible 5oftware : Have a break! Take a ride on Python's Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/ 14109 Berlin : PGP key -> http://wwwkeys.pgp.net/ work +49 30 89 09 53 34 home +49 30 802 86 56 mobile +49 173 24 18 776 PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4