From e441c291b2e10c8de85a9d950d0add552d0ebd83 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Fri, 16 Feb 2018 21:36:38 -0800 Subject: MAINT: Stop using non-tuple indices internally By not using this type of indexing, it becomes easier for subclasses to override indexing in a way that works correctly with numpy functions. These locations were found by deprecating the behavior in question, which is deliberately not part of this commit --- numpy/ma/extras.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'numpy/ma/extras.py') diff --git a/numpy/ma/extras.py b/numpy/ma/extras.py index 99f5234d1..e247fe170 100644 --- a/numpy/ma/extras.py +++ b/numpy/ma/extras.py @@ -724,6 +724,7 @@ def _median(a, axis=None, out=None, overwrite_input=False): # as median (which is mean of empty slice = nan) indexer = [slice(None)] * asorted.ndim indexer[axis] = slice(0, 0) + indexer = tuple(indexer) return np.ma.mean(asorted[indexer], axis=axis, out=out) if asorted.ndim == 1: @@ -1716,7 +1717,7 @@ def notmasked_contiguous(a, axis=None): # for i in range(a.shape[other]): idx[other] = i - result.append(flatnotmasked_contiguous(a[idx]) or None) + result.append(flatnotmasked_contiguous(a[tuple(idx)]) or None) return result -- cgit v1.2.1