It's worth noting that the Itertools.
As it turns out, behind the scenes Itertools.
As already pointed out by many, Itertools.
You can simply use Itertools.
However, this can be done more efficiently with Itertools:.
I don't have experience with Itertools, so I have to ask for help.
For example, you might even use generators to implement infinitely-long lazy lists like Itertools.
With the brand new Python 2.6,
you have a standard solution with the Itertools module that returns the Cartesian product of iterables:.
To get a better feel for generators, you can play around with the Itertools module(be sure to use chain.
from_iterable rather than chain when warranted).