I'm a little bit new to Python & Numpy, but I've noticed that when you call operator []
on a numpy array A
, if it's a single index that is used (e.g., A[1]
), the resulting sub-array is 1 dimension smaller, but if it's a range of indices (e.g., A[1:]
) the dimension of the subarray remains unchanged, even if the range of indices covers only a single index, e.g., in this above case, if A
was 2x2
, A[1:]
is effectively just a single index, but the resulting size is not the same as A[1]
.
My question is: is this always true in that if you supply a range of indices when extracting a subarray, the dimension doesn't change, and that a single index always reduces the dimension by 1? Are there edge cases?