summaryrefslogtreecommitdiff
path: root/doc/source/reference
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2018-02-16 21:38:23 -0800
committerEric Wieser <wieser.eric@gmail.com>2018-05-25 23:06:43 -0700
commit0addc016ba7000b27509663f4f489c6eb1838056 (patch)
tree3b1f1cabcdee01e7a625f17ffe8970b878f4f8e3 /doc/source/reference
parente441c291b2e10c8de85a9d950d0add552d0ebd83 (diff)
downloadnumpy-0addc016ba7000b27509663f4f489c6eb1838056.tar.gz
DEP: Deprecate non-tuple multidimensional indices
Currently, arr[[None, 0]] and arr[(None, 0)] mean the same thing, yet arr[[0, 0]] and arr[(0, 0)] mean different things. This makes it super hard to make a subclass or duck array that behaves consistently with ndarray. By deprecating this feature, we force downstream library code to stop using it, which in turn makes that library code use approaches that are easier to implement in subclasses and duck types.
Diffstat (limited to 'doc/source/reference')
-rw-r--r--doc/source/reference/arrays.indexing.rst17
1 files changed, 11 insertions, 6 deletions
diff --git a/doc/source/reference/arrays.indexing.rst b/doc/source/reference/arrays.indexing.rst
index b5a44c22a..ba1bfd312 100644
--- a/doc/source/reference/arrays.indexing.rst
+++ b/doc/source/reference/arrays.indexing.rst
@@ -29,11 +29,15 @@ dimensions. Basic slicing occurs when *obj* is a :class:`slice` object
(constructed by ``start:stop:step`` notation inside of brackets), an
integer, or a tuple of slice objects and integers. :const:`Ellipsis`
and :const:`newaxis` objects can be interspersed with these as
-well. In order to remain backward compatible with a common usage in
-Numeric, basic slicing is also initiated if the selection object is
-any non-ndarray sequence (such as a :class:`list`) containing :class:`slice`
-objects, the :const:`Ellipsis` object, or the :const:`newaxis` object,
-but not for integer arrays or other embedded sequences.
+well.
+
+.. deprecated:: 1.15.0
+
+ In order to remain backward compatible with a common usage in
+ Numeric, basic slicing is also initiated if the selection object is
+ any non-ndarray and non-tuple sequence (such as a :class:`list`) containing
+ :class:`slice` objects, the :const:`Ellipsis` object, or the :const:`newaxis`
+ object, but not for integer arrays or other embedded sequences.
.. index::
triple: ndarray; special methods; getitem
@@ -196,7 +200,8 @@ basic slicing that returns a :term:`view`).
why this occurs.
Also recognize that ``x[[1,2,3]]`` will trigger advanced indexing,
- whereas ``x[[1,2,slice(None)]]`` will trigger basic slicing.
+ whereas due to the deprecated Numeric compatibility mentioned above,
+ ``x[[1,2,slice(None)]]`` will trigger basic slicing.
Integer array indexing
^^^^^^^^^^^^^^^^^^^^^^