From 781468b5938ce1a79804613b222063d81e99963d Mon Sep 17 00:00:00 2001 From: Jay Bourque Date: Tue, 17 Jul 2012 11:59:56 -0500 Subject: Updated reference docs for DeprecationWarning --- doc/source/reference/arrays.indexing.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'doc/source') diff --git a/doc/source/reference/arrays.indexing.rst b/doc/source/reference/arrays.indexing.rst index 8da4ecca7..bc12c5d0e 100644 --- a/doc/source/reference/arrays.indexing.rst +++ b/doc/source/reference/arrays.indexing.rst @@ -335,6 +335,16 @@ sub-array) but of data type ``x.dtype['field-name']`` and contains only the part of the data in the specified field. Also record array scalars can be "indexed" this way. +Indexing into a record array can also be done with a list of field names, +*e.g.* ``x[['field-name1','field-name2']]``. Currently this returns a new +array containing a copy of the values in the fields specified in the list. +As of NumPy 1.7, returning a copy is being deprecated in favor of returning +a view. A copy will continue to be returned for now, but a DeprecationWarning +will be issued when writing to the copy. If you depend on the current +behavior, then we suggest copying the returned array explicitly, i.e. use +x[['field-name1','field-name2']].copy(). This will work with both past and +future versions of NumPy. + If the accessed field is a sub-array, the dimensions of the sub-array are appended to the shape of the result. -- cgit v1.2.1