summaryrefslogtreecommitdiff
path: root/numpy/core/fromnumeric.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-08-11 20:52:39 -0600
committerCharles Harris <charlesr.harris@gmail.com>2013-08-22 09:50:56 -0600
commitfd6cfd6828950850da27b09dab93a06dfe86308f (patch)
tree933b759ee252fc9224aa7d0704365b263a1db5f9 /numpy/core/fromnumeric.py
parent9464075c7260475bdd5d693b3046379a2bb62482 (diff)
downloadnumpy-fd6cfd6828950850da27b09dab93a06dfe86308f.tar.gz
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.
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r--numpy/core/fromnumeric.py15
1 files changed, 7 insertions, 8 deletions
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.