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.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 3ca566f73..ca5ef62ae 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -33,7 +33,7 @@ from numpy.core.umath import _add_newdoc_ufunc as add_newdoc_ufunc
import builtins
# needed in this module for compatibility
-from numpy.lib.histograms import histogram, histogramdd
+from numpy.lib.histograms import histogram, histogramdd # noqa: F401
array_function_dispatch = functools.partial(
@@ -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