From fd6cfd6828950850da27b09dab93a06dfe86308f Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Sun, 11 Aug 2013 20:52:39 -0600 Subject: ENH: Make the ndarray diagonal method return a view. Also remove the test_diagonal_deprecation test and add test that checks that a view is returned and that it is not writeable. Closes #596. --- numpy/core/fromnumeric.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'numpy/core/fromnumeric.py') diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index ca18d64ea..8d2c6ac95 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -1125,16 +1125,15 @@ def diagonal(a, offset=0, axis1=0, axis2=1): In versions of NumPy prior to 1.7, this function always returned a new, independent array containing a copy of the values in the diagonal. - In NumPy 1.7, it continues to return a copy of the diagonal, but depending - on this fact is deprecated. Writing to the resulting array continues to - work as it used to, but a FutureWarning will be issued. + In NumPy 1.7 and 1.8, it continues to return a copy of the diagonal, + but depending on this fact is deprecated. Writing to the resulting + array continues to work as it used to, but a FutureWarning is issued. - In NumPy 1.9, it will switch to returning a read-only view on the original - array. Attempting to write to the resulting array will produce an error. + In NumPy 1.9 it returns a read-only view on the original array. + Attempting to write to the resulting array will produce an error. - In NumPy 1.10, it will still return a view, but this view will no longer be - marked read-only. Writing to the returned array will alter your original - array as well. + In NumPy 1.10, it will return a read/write view, Writing to the returned + array will alter your original array. If you don't write to the array returned by this function, then you can just ignore all of the above. -- cgit v1.2.1