<div dir="ltr">There was a discussion last year about slicing along specified axes in numpy arrays:<div><a href="http://mail.scipy.org/pipermail/numpy-discussion/2012-April/061632.html">http://mail.scipy.org/pipermail/numpy-discussion/2012-April/061632.html</a><br>
</div><div><br></div><div>I'm finding that slicing along specified axes is a common task for me when writing code to manipulate N-D arrays.</div><div><br></div><div>The method ndarray.take basically does what I would like, except it cannot take slice objects as argument. In the mean-time, I've written a little helper function:</div>
<div><br></div><div><div>def take(a, indices, axis):</div><div>    index = [slice(None)] * a.ndim</div><div>    index[axis] = indices</div><div>    return a[tuple(index)]</div></div><div><br></div><div>Is there support for allowing the `indices` argument to `take` to take Python slice objects as well as arrays? That would alleviate the need for my helper function.</div>
<div><br></div><div>Cheers,</div><div>Stephan</div><div><br></div><div><br></div></div>