Suppose I want to loop through the indices of a multi-dimensional array. What I currently have is:
import numpy as np
points = np.ndarray((1,2,3))
for x in range(points.shape[0]):
for y in range(points.shape[1]):
for z in range(points.shape[2]):
print(x,y,z)
I would like to reduce the nesting and be able to loop over all indices of the multi-dimensional array in a simple one-liner. Could it also be written in the following form?
points = np.ndarray((1,2,3))
for (x, y, z) in ?? :
print(x,y,z)