[Numpy-discussion] how do I list all combinations
Mathew Yeates
myeates at jpl.nasa.gov
Wed Dec 26 15:22:23 EST 2007
Hi
I've been looking at "fromfunction" and itertools but I'm flummoxed.
I have an arbitrary number of lists. I want to form all possible
combinations from all lists. So if
r1=["dog","cat"]
r2=[1,2]
I want to return [["dog",1],["dog",2],["cat",1],["cat",2]]
It's obvious when the number of lists is not arbitrary. But what if
thats not known until runtime?
Mathew
More information about the NumPy-Discussion
mailing list