summaryrefslogtreecommitdiff
path: root/numpy/add_newdocs.py
diff options
context:
space:
mode:
authorMark Wiebe <mwwiebe@gmail.com>2011-03-15 11:14:03 -0700
committerMark Wiebe <mwwiebe@gmail.com>2011-03-15 11:18:57 -0700
commitaada93306acfb4e2eb816faf32652edf8825cf45 (patch)
treea55c8e872bf8f1c0c714151edf9209b9cbde8306 /numpy/add_newdocs.py
parentc1bec1ddc38648b415df4387e4172e32c29a1d94 (diff)
downloadnumpy-aada93306acfb4e2eb816faf32652edf8825cf45.tar.gz
ENH: Add 'subok' parameter to PyArray_NewLikeArray, np.empty_like, np.zeros_like, and np.ones_like
This way, the sub-type can be avoided if necessary. This helps mitigate, but doesn't fix, ticket #1753, by allowing "b = np.empty_like(a, subok=False)".
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r--numpy/add_newdocs.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index 8499b3d9d..5baf7424b 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -454,7 +454,7 @@ add_newdoc('numpy.core.multiarray', 'empty',
add_newdoc('numpy.core.multiarray', 'empty_like',
"""
- empty_like(a, dtype=None, order='K')
+ empty_like(a, dtype=None, order='K', subok=True)
Return a new array with the same shape and type as a given array.
@@ -470,6 +470,10 @@ add_newdoc('numpy.core.multiarray', 'empty_like',
'F' means F-order, 'A' means 'F' if ``a`` is Fortran contiguous,
'C' otherwise. 'K' means match the layout of ``a`` as closely
as possible.
+ subok : bool, optional.
+ If True, then the newly created array will use the sub-class
+ type of 'a', otherwise it will be a base-class array. Defaults
+ to True.
Returns
-------