Josiah Carlson <[EMAIL PROTECTED]> writes: > James Stroud wrote: >> Terry Reedy wrote: >>> In Python, you have a choice of recursion (normal or tail) >> >> Please explain this. I remember reading on this newsgroup that an advantage >> of ruby (wrt python) is that ruby has tail recursion, implying that python >> does not. Does python have fully optimized tail recursion as described in >> the tail recursion Wikipedia entry? Under what circumstances can one count >> on the python interpreter recognizing the possibility for optimized tail >> recursion? > > Note that Terry said that you could do normal or tail recursion, he didn't > claim that either were optimized.
Well yeah, but without the implication how do the two words "or tail" add to the information content of the sentence? > As for why tail calls are not optimized out, it was decided that being able > to have the stack traces (with variable information, etc.) was more useful > than offering tail call optimization I don't buy this. What's more important, making code not fail arbitrarily (and thus making approaches to certain problems feasible that otherwise wouldn't be) or making it a be a bit easier to debug code that will fail arbitrarily? Why not only do tail-call optimization in .pyo files and get the best of both worlds? > (do what I say). Where did you say run out of memory and fail? More importantly how do you say "don't run out of memory and fail"? 'as -- http://mail.python.org/mailman/listinfo/python-list