Perhaps the easiest way is to make x[None, 10, :] x[np.newaxis, 10, :] x[None, 10, :] or the equivalent (but more readable) x[np.newaxis, 10, :] .
As far as this is by default, I personally find that constantly having arrays with singleton sizes is very annoying very quickly. I guess numpy devs felt the same way.
In addition, multilevel processing of broadcast arrays is very convenient, so there is usually no reason to maintain the dimension of the array from which the slice is obtained. If you have done this, then things like:
a = np.zeros((100,100,10)) b = np.zeros(100,10) a[0,:,:] = b
either will not work, or it will be much more difficult to implement.
(Or at least my suggestion that numpy dev is talking about reducing size information when cutting)
Joe Kington Aug 23 '10 at 21:30 2010-08-23 21:30
source share