diff options
author | jaimefrio <jaime.frio@gmail.com> | 2015-01-20 19:15:00 -0800 |
---|---|---|
committer | jaimefrio <jaime.frio@gmail.com> | 2015-01-20 19:15:16 -0800 |
commit | 1d3bcb446771ff16e9cf06e3a5d9cac20e68c4ac (patch) | |
tree | bc99b9fe2d16713d54216cbd01b30c244406628a /numpy/core/fromnumeric.py | |
parent | 4ed1587a7de85b4fa01dff8ef6e0e901a25f149c (diff) | |
download | numpy-1d3bcb446771ff16e9cf06e3a5d9cac20e68c4ac.tar.gz |
ENH: Make swapaxes always return a view
swapaxes now returns a view of the input array when the axes to swap
are both the same, not the input array as it used to do. Fixes #5260
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r-- | numpy/core/fromnumeric.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index 2a527a4a4..aef09411a 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -464,8 +464,10 @@ def swapaxes(a, axis1, axis2): Returns ------- a_swapped : ndarray - If `a` is an ndarray, then a view of `a` is returned; otherwise - a new array is created. + For Numpy >= 1.10, if `a` is an ndarray, then a view of `a` is + returned; otherwise a new array is created. For earlier Numpy + versions a view of `a` is returned only if the order of the + axes is changed, otherwise the input array is returned. Examples -------- |