You could also use numpy.ndindex to achieve what you are looking for:
import numpy
for y1, y2, y3 in numpy.ndindex(x2, x4, ...):
...
Thats especially useful when you are already using numpy for something else in your script. You would have to add the 'starting point' (i.e. x1, x2, ...) to each dimension though (if it's not 0).