Consider the following snippet:
a = np.ones((2,2,2,2,2))
for example in a:
for row in example:
for col in row:
for box in col:
print (box.shape)
Having so many nested for
s makes for some very ugly code.
How can I get the same effect with only one explicit iteration?