From aada93306acfb4e2eb816faf32652edf8825cf45 Mon Sep 17 00:00:00 2001 From: Mark Wiebe Date: Tue, 15 Mar 2011 11:14:03 -0700 Subject: 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)". --- doc/source/reference/c-api.array.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'doc/source/reference') 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 -- cgit v1.2.1