Hi Valentin,

On 8 October 2013 13:23, Valentin Haenel <[email protected]> wrote:

> Certain functions, like
> `PyArray_SimpleNewFromData` `PyArray_SimpleNew` take a typeenum
> Is there any way to go from typeenum to something that can be
> passed to the dtype constructor, like mapping 12 -> '<f8'?
>

If you just want the corresponding dtype instance (aka PyArray_Descr) then
`PyArray_DescrFromType` should be what you're after.

But if you really need the '<f8' string then I'd be tempted to get the
PyArray_Descr and then use the Python API (e.g. PyObject_GetAttrString) to
request the "str" attribute. Under the hood this attribute is implemented
by `arraydescr_protocol_typestr_get` but that's not part of the public API.

Regards,
Richard Hattersley
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to