Shane Hathaway wrote: > Shane Hathaway wrote: >> I'm interested in seeing a good way to write tail calls in Python. Some >> algorithms are more readable when expressed using tail recursion. > > About ten seconds after I wrote the previous message, I realized two things: > > - It's easy to write "return Return" instead of "raise Return". So > "raise TailCall" is probably better. > > - I can write a complete implementation of this idea with nothing but a > simple decorator. Check it out!
With yet another 10 seconds, I realized my quick implementation actually does nothing to optimize tail calls. Working on a fix. Shane _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com