On Tue, Aug 27, 2002 at 06:14:51PM +1200, Greg Ewing wrote: > > [f(x, y) for x in X for y in Y] > > > > is equivalent to: > > > > [f(x, y) for x, y in cartesian(X, Y)] > > Hmmm, in other words, cartesian() is a lazy version > of zip(). Nope. >>> zip([1, 2], ['a', 'b']) [(1, 'a'), (2, 'b')] >>> list(cartesian([1, 2], ['a', 'b'])) [(1, 'a'), (1, 'b'), (2, 'a'), (2, 'b')] Oren