I want to loop through a three-dimensional array. Is there any alternative method which is more efficient (or faster) than the following?
for i, j, k in itertools.product(*map(xrange, (len(x), len(y), len(z))))
In this example, x, y and z are three one-dimensional arrays.
My source code is this, I do not want the value of lists.
for i, j, k in itertools.product(*map(xrange, (len(x0), len(y0), len(z0)))):
print "p[%d][%d][%d] = %d" % (x0[i], y0[j], z0[k], p[i][j][k])
p
being the 3d-array