[Numpy-discussion] Getting ield lenghts in extension module

Erin Sheldon erin.sheldon at gmail.com
Fri May 18 16:26:39 EDT 2007


Hi all -

I'm writing an extension module and I have a PyArrayObject with fields
created with PyArray_Zeros from a PyArray_Descr object.  In other
words, this is an array of non-homogeneous data records, for example:

  dtype([('x', '<f8'), ('y', '<i4', 2)])

I need to fill the fields with numbers from a file.  The fields of the
array are only a subset of the fields of the file, so I can't just
read it as one chunk with fromfile() or some equivalent.  Rather I
need to get the field lengths from these objects.

How can I get the length of each field in bytes?

Thanks,
Erin



More information about the NumPy-Discussion mailing list