summaryrefslogtreecommitdiff
path: root/numpy/core/numeric.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/core/numeric.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/core/numeric.py')
-rw-r--r--numpy/core/numeric.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index 187296efe..dce617846 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -62,7 +62,7 @@ ufunc = type(sin)
# originally from Fernando Perez's IPython
-def zeros_like(a, dtype=None, order='K'):
+def zeros_like(a, dtype=None, order='K', subok=True):
"""
Return an array of zeros with the same shape and type as a given array.
@@ -112,7 +112,7 @@ def zeros_like(a, dtype=None, order='K'):
array([ 0., 0., 0.])
"""
- res = empty_like(a, dtype=dtype, order=order)
+ res = empty_like(a, dtype=dtype, order=order, subok=subok)
res.fill(0)
return res