summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 3ca566f73..67563873b 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -779,6 +779,17 @@ def copy(a, order='K', subok=False):
>>> x[0] == z[0]
False
+ Note that, np.copy clears previously set WRITEABLE=False flag.
+
+ >>> a = np.array([1, 2, 3])
+ >>> a.flags["WRITEABLE"] = False
+ >>> b = np.copy(a)
+ >>> b.flags["WRITEABLE"]
+ True
+ >>> b[0] = 3
+ >>> b
+ array([3, 2, 3])
+
Note that np.copy is a shallow copy and will not copy object
elements within arrays. This is mainly important for arrays
containing Python objects. The new array will contain the