(newbie) N-uples from list of lists

bonono at gmail.com bonono at gmail.com
Thu Nov 24 04:51:16 CET 2005


Alex Martelli wrote:
> bonono at gmail.com <bonono at gmail.com> 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.




More information about the Python-list mailing list