I would expect the following snippet to give me an iterator yielding pairs from the Cartesian product of the two input iterables:
$ python
Python 2.7.1+ (r27
I think the problem could be that xrange returns its own special sort of object, which is not a normal iterable.
xrange is implemented in such a way (as are lists) that you can iterate over the object many times, while you can iterate over a normal generator object only once. So perhaps something from this functionality is responsible for the memory error.