diff options
author | Travis E. Oliphant <teoliphant@gmail.com> | 2012-07-17 19:37:09 -0700 |
---|---|---|
committer | Travis E. Oliphant <teoliphant@gmail.com> | 2012-07-17 19:37:09 -0700 |
commit | bc1005324566269d016ad9c17a25b43c6b9fc1de (patch) | |
tree | 3ba747f68dcc2c0403c020fd67d84dabad3cdb8c /doc | |
parent | 578a4199a81e7464011661fcf8d46a8af2235db2 (diff) | |
parent | a03e8b4d286e91ef5823c059dcfb7a52ce420725 (diff) | |
download | numpy-bc1005324566269d016ad9c17a25b43c6b9fc1de.tar.gz |
Merge pull request #350 from jayvius/get-view2
Add transition code for returning view when selecting subset of fields
Diffstat (limited to 'doc')
-rw-r--r-- | doc/release/1.7.0-notes.rst | 7 | ||||
-rw-r--r-- | doc/source/reference/arrays.indexing.rst | 10 |
2 files changed, 17 insertions, 0 deletions
diff --git a/doc/release/1.7.0-notes.rst b/doc/release/1.7.0-notes.rst index e8b1de72d..f8f54219c 100644 --- a/doc/release/1.7.0-notes.rst +++ b/doc/release/1.7.0-notes.rst @@ -26,6 +26,13 @@ functions. To facilitate this transition, numpy 1.7 produces a FutureWarning if it detects that you may be attempting to write to such an array. See the documentation for np.diagonal for details. +Similar to np.diagonal above, in a future version of numpy, indexing +a record array by a list of field names will return a view onto the +original array, instead of producing a copy as they do now. As with +np.diagonal, numpy 1.7 produces a FutureWarning if it detects +that you may be attemping to write to such an array. See the documentation +for array indexing for details. + The default casting rule for UFunc out= parameters has been changed from 'unsafe' to 'same_kind'. Most usages which violate the 'same_kind' rule are likely bugs, so this change may expose previously undetected diff --git a/doc/source/reference/arrays.indexing.rst b/doc/source/reference/arrays.indexing.rst index 8da4ecca7..f8966f5c1 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 FutureWarning +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. |