Paul Rubin wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >>> Not tail calls, in general, no. >> Sorry, how does that work? You're suggesting that there is an algorithm >> which the compiler could follow to optimize away tail-recursion, but human >> beings can't follow the same algorithm? >> >> Now I'm confused. > > The usual compiler method is to translate the code into > continuation-passing style and thereby gain tail-recursion > optimization automagically. Of course a human could do the same thing > in principle, but it would result in insanely difficult-to-write, > unreadable and unmaintainable code. At a higher level, there are no > Python features whatsoever, either existing or proposed, that couldn't > be eliminated and left to the human. Iterators? While loops? Who > needs 'em? We could all go back to programming in machine code. But > Python is supposed to make programming easier, not harder.
Thanks to Richie Hindle, there exists a goto for Python implementation that makes such things quite trivial (assuming one doesn't like "abusing" break/continue/else). http://entrian.com/goto/ (which, by the way, is the best April-fools joke ever) - Josiah -- http://mail.python.org/mailman/listinfo/python-list