[Numpy-discussion] Support for understand ctypes data-types now in SVN
oliphant at ee.byu.edu
Fri Nov 17 14:42:56 CST 2006
Stefan van der Walt wrote:
>On Fri, Nov 17, 2006 at 12:43:45PM -0700, Travis Oliphant wrote:
>>The NumPy dtype command now understands ctypes data-types including
>>derived structures and arrays.
>>This means you can specify data-types using ctypes method of building
>>structures and pass those classes whenever NumPy expects a data-type
>>import ctypes as ct
>>import numpy as np
>> _fields_ = [("x", ct.c_int),
>> ("y", ct.c_int)]
>Is the memory layout of the array above the same as what an array of
>POINTs would be in C, or are they not padded?
I just changed this in SVN. Previously it would not use padding because
the array_descriptor format assumed all padding was specified. I
changed this so that array_descriptor format can also now account for
Then, if the object has a _fields_ attribute, then it automatically does
As a result, now using ctypes objects will guarantee padding.
More information about the Numpy-discussion