On 8 October 2013 19:56, Valentin Haenel <[email protected]> wrote: > I ended up using: PyArray_TypeObjectFromType > from cython so: > > np.dtype(cnp.PyArray_TypeObjectFromType(self.ndtype)).str > > Maybe i can avoid the np.dtype call, when using PyArray_Descr? >
In short: yes. `PyArray_TypeObjectFromType` first uses `PyArray_DescrFromType` to figure out the dtype from the type number, and then it returns the corresponding array scalar type. Passing this array scalar type to `np.dtype` gets you back to the dtype that had just been looked up inside TypeObjectFromType. Regards, Richard
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
