summaryrefslogtreecommitdiff
path: root/doc/source/reference/arrays.indexing.rst
diff options
context:
space:
mode:
authorwtli <liwt31@163.com>2019-03-06 17:33:48 +0800
committerwtli <liwt31@163.com>2019-03-14 21:25:37 +0800
commite0ffa191ade1ac8548cad38a73fecc9f2528f9ef (patch)
tree1dd255c6ce897a36ed838fed356d821b53f09335 /doc/source/reference/arrays.indexing.rst
parent1a15c074f002cb7520e347392841b6b371c71361 (diff)
downloadnumpy-e0ffa191ade1ac8548cad38a73fecc9f2528f9ef.tar.gz
DOC: add copy on slicing notice
Diffstat (limited to 'doc/source/reference/arrays.indexing.rst')
-rw-r--r--doc/source/reference/arrays.indexing.rst11
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/source/reference/arrays.indexing.rst b/doc/source/reference/arrays.indexing.rst
index 3a319ecca..0c0c8dff6 100644
--- a/doc/source/reference/arrays.indexing.rst
+++ b/doc/source/reference/arrays.indexing.rst
@@ -57,6 +57,17 @@ interpreted as counting from the end of the array (*i.e.*, if
All arrays generated by basic slicing are always :term:`views <view>`
of the original array.
+.. note::
+
+ NumPy slicing creates a :term:`view` instead of a copy as in the case of
+ builtin Python sequences such as string, tuple and list.
+ Care must be taken when extracting
+ a small portion from a large array which becomes useless after the
+ extraction, because the small portion extracted contains a reference
+ to the large original array whose memory will not be released until
+ all arrays derived from it are garbage-collected. In such cases an
+ explicit ``copy()`` is recommended.
+
The standard rules of sequence slicing apply to basic slicing on a
per-dimension basis (including using a step index). Some useful
concepts to remember include: