Keith Goodman wrote: > Is this a reasonable (and fast) way to create a bool array in cython? > > def makebool(): > cdef: > int n = 2 > np.npy_intp *dims = [n] > np.ndarray[np.uint8_t, ndim=1] a > a = PyArray_EMPTY(1, dims, NPY_UINT8, 0) > a[0] = 1 > a[1] = 0 > a.dtype = np.bool > return a > > Will a numpy bool array be np.uint8 on all platforms? > > How can I do a.dtype=np.bool using the numpy C api? Is there any point > (speed) in doing so?
Cython has it's own mail lists - maybe you can find more answers there. _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion