(newbie) N-uples from list of lists

Alex Martelli aleax at mail.comcast.net
Wed Nov 23 23:20:02 EST 2005


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

Yep, that's recursion elimination for you -- once in a while it will
guide you to a "truly" nonrecursive solution that you had not
considered, but mostly it's just an optimization (in almost ANY
language, generally -- recursion in most languages stacks up everything
whether it needs to or not, with elimination you get to stack up the
minimal needed amount of state, so it can be faster) fully including the
"obfuscation" typical of optimizations;-)


Alex



More information about the Python-list mailing list