Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Mike C. Fletcher <[EMAIL PROTECTED]> wrote: > >>Python iterates over "things" (objects), of which integer numbers are >>just one possible choice. The range built-in command produces ranges of >>integers which are useful for tasks such as this. >>
[...clip (something that begs of recursion)...] > I don't think the list comprehension helps, in this case--although > it hints at the temptation of an eval-able expression which is > briefer. More on that, later. This goes backwards. Going forwards is left as an exercise for whomever: def do_something(*args): print args def do_deeply(first, depth, lim, todo, inc, *args): if depth < lim: do_deeply(first+inc, depth+inc, lim, todo, inc, *args) if first < depth: do_deeply(first+inc, depth, lim, todo, inc, *args + (first,)) else: do_something(*args) do_deeply(first=1, depth=6, lim=8, todo=do_something, inc=1) James -- http://mail.python.org/mailman/listinfo/python-list