Alex Martelli wrote: > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Out of curiousity, is "recursion" the desirable way(or is it pythonic > > way) ? How would one do it in the imperative way ? > > For an inherently recursive problem (as this one appears to be), the > traditional alternative to recursion is maintaining your own LIFO stack. > If (with all the obvious refactorings) things gets messy, ah well, at > least you've broken free of the recursion limit;-). [[ Sometimes > (rarely) things don't get messy, and then you find out that the problem > wasn't really "inherently recursive";-) ]] > > An example of recursion elimination in Python can be found at > <http://mail.python.org/pipermail/python-list/2002-January/082481.html> > Thanks, so it seems that it is only doing the "stacking" oneself rather than relies on the recursive calls(which does the stack for you). Or in other worlds, a way to get around the recursion limitation but seems to be harder to understand in this case.
-- http://mail.python.org/mailman/listinfo/python-list