En Wed, 14 Feb 2007 10:41:53 -0300, Neil Cerutti <[EMAIL PROTECTED]> escribió:
> On 2007-02-14, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >> Python does not do "tail recursion optimization" (at >> least, I'm not aware of that). > > To be just a little pedantic, it's "tail call optimization". Any > tail call can be optimized, not just recursive ones. Maybe, but I didn't invent the term: http://computing-dictionary.thefreedictionary.com/tail%20recursion%20optimisation It's true that tail recursion is a special case of tail call - but it's just the case that can be managed by hand, no special support on the language -trampoline or whatever- is required (just a loop, "GOTO 1"). >> But even if it could do that, in this case you have recursive >> calls between two functions, and that's a bit harder. > > So the effect is that mutual recursion isn't actually any harder. But some kind of language support is required in this case. At least I don't know how to handle mutual recursion (apart from inlining one function inside the other...). But I'm certainly not a "program transformation guru" (neither a novice!) so I would not be surprised if someone says it can be done... -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list