I am working on a Python C-extension code. Currently, a 1D C-array is converted to a Python List. Now I need to convert an ND-array, described by a 1) data type, 2) shape (as a 1D integer vector, for example, 2x4x3 array), and 3) data binary payload as serialized array elements of data-type.
I noticed that there is an array
object in python: https://docs.python.org/2/library/array.html
I prefer to convert the ND array buffer to an array
object instead of requiring installation of numpy
ndarray - an additional dependency, but I failed to find any C-API to create/read/write Python-array
objects from C.
does this interface (something similar to PyList_New
) exist?