Is there a less verbose alternative to this:
for x in xrange(array.shape[0]): for y in xrange(array.shape[1]): do_stuff(x, y)
I
If you only need the indices, you could try numpy.ndindex:
>>> a = numpy.arange(9).reshape(3, 3) >>> [(x, y) for x, y in numpy.ndindex(a.shape)] [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)]