Hi everyone,

I'm new to Python and the notion of lambda, and I'm trying to write a
function that would have a varying number of nested for loops
depending on parameter n. This just smells like a job for lambda for
me, but I can't figure out how to do it. Any hint?

For example, for n=2, I want the function to look something like:

def foo(2)
   generate 2 sets of elements A, B
   # mix elements by:
   for a_elt in A
      for b_elt in B
         form all combinations of them


If n=3, I want to have 3 sets of elements and mix them up using 3 for
loops.

Any help is greatly appreciated,

nullgraph
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to