diff options
author | Mark Wiebe <mwwiebe@gmail.com> | 2011-03-15 11:14:03 -0700 |
---|---|---|
committer | Mark Wiebe <mwwiebe@gmail.com> | 2011-03-15 11:18:57 -0700 |
commit | aada93306acfb4e2eb816faf32652edf8825cf45 (patch) | |
tree | a55c8e872bf8f1c0c714151edf9209b9cbde8306 /doc/source | |
parent | c1bec1ddc38648b415df4387e4172e32c29a1d94 (diff) | |
download | numpy-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 'doc/source')
-rw-r--r-- | doc/source/reference/c-api.array.rst | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/doc/source/reference/c-api.array.rst b/doc/source/reference/c-api.array.rst index 05f077936..8c2b3a34e 100644 --- a/doc/source/reference/c-api.array.rst +++ b/doc/source/reference/c-api.array.rst @@ -158,7 +158,7 @@ From scratch *dims* and *strides* are copied into newly allocated dimension and strides arrays for the new array object. -.. cfunction:: PyObject* PyArray_NewLikeArray(PyArrayObject* prototype, NPY_ORDER order, PyArray_Descr* descr) +.. cfunction:: PyObject* PyArray_NewLikeArray(PyArrayObject* prototype, NPY_ORDER order, PyArray_Descr* descr, int subok) .. versionadded:: 1.6 @@ -176,6 +176,10 @@ From scratch If *descr* is NULL, the data type of *prototype* is used. + If *subok* is 1, the newly created array will use the sub-type of + *prototype* to create the new array, otherwise it will create a + base-class array. + .. cfunction:: PyObject* PyArray_New(PyTypeObject* subtype, int nd, npy_intp* dims, int type_num, npy_intp* strides, void* data, int itemsize, int flags, PyObject* obj) This is similar to :cfunc:`PyArray_DescrNew` (...) except you |