Q:

Is there any specification for the behavior of multilevel slicing in Python?

Is there any specification for the behavior of taking slices at multiple levels with a Python list of lists? For instance, here's a 4 x 5 x 3 list of lists:
>>> a_4_by_5_by_3 = [[[(5*3*r + 3*c + p) for p in range(0,3)] for c in range(0,5)] for r in range(0,4)]
>>> a_4_by_5_by_3
[[[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]], [[15, 16, 17], [18, 19, 20], [21, 22, 23], [24, 25, 26], [27, 28, 29]], [[30, 31, 32], [33, 34, 35], [36, 37, 38], [39, 40, 41], [42, 43, 44]], [[45, 46, 47], [48, 49, 50], [51, 52, 53], [54, 55, 56], [57, 58, 59]]]

If you take a two-element slice in the first dimension and a three-element in the second dimension, the code is not rejected, but the slicing in the second dimension seems to be ignored:
>>> a_4_by_5_by_3[0:2][0:3]
[[[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]], [[15, 16, 17], [18, 19, 20], [21, 22, 23], [24, 25, 26], [27, 28, 29]]]

If the slicing in the second dimension were not ignored, there would be only three elements per row:
[[[0, 1, 2], [3, 4, 5], [6, 7, 8]], [[15, 16, 17], [18, 19, 20], [21, 22, 23]]]

Is this known behavior? I haven't been able to find anything in the official Python documentation that comments on this one way or the other. I'm using Python 3.6, for what it's worth.

A:

x = a_4_by_5_by_3[0:2][0:3]

is basically equivalent to 
x = a_4_by_5_by_3[0:2]
x = x[0:3]

, so you end up getting a slice 2 items long, then attempting to slice up to the third item, which is implicitly clamped down to the length of the sequence.
If you're looking to slice multidimensional matrices at will, you'll probably want to make them Numpy arrays, which have very interesting indexing operations.

