I\'m working with an n-dimensional array, and I\'d like a way to reverse a numbered dimension. So rather than
rev = a[:,:,::-1]
I\'d like to be
For anyone coming across this in the future:
Numpy 1.12+ has the function np.flip(array, dimension), which does exactly as requested. Even better, it returns a view of the data rather than a copy, and so it happens in constant time.