On Mon, Apr 9, 2012 at 12:14 PM, Jonathan T. Niehof <jnie...@lanl.gov>wrote:
> On 04/06/2012 06:54 AM, Benjamin Root wrote: > > > Take a peek at how np.gradient() does it. It creates a list of None with > > a length equal to the number of dimensions, and then inserts a slice > > object in the appropriate spot in the list. > > List of slice(None), correct? At least that's what I see in the source, > and: > > >>> a = numpy.array([[1,2],[3,4]]) > >>> operator.getitem(a, (None, slice(1, 2))) > array([[[3, 4]]]) > >>> operator.getitem(a, (slice(None), slice(1, 2))) > array([[2], > [4]]) > > Correct, sorry, I was working from memory. Ben Root
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion