Carl Johnson schrieb:
for a in [True, False]: for b in [True, False]: for c in [True, False]: print a, b, c
Which yields
True True True True True False True False True True False False False True True False True False False False True False False False
But if you don't know how many variables you'll have, you're stuck writing a complicated function instead of using a nice, simple for-loop.
So, going back to the first example, wouldn't it be nicer to write:
for x, y, z in combine(xs, ys, zs): #Do something
So, what do you think? Is this a common enough need that it should be built into itertools?
Presumably, since it has been added to itertools in 2.6 under the name product(). (Maybe Raymond borrowed the time machine?) :)
Georg