[Numpy-discussion] Support for understand ctypes data-types now in SVN
Travis Oliphant
oliphant at ee.byu.edu
Fri Nov 17 13:43:45 CST 2006
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
object.
Simple example:
import ctypes as ct
import numpy as np
np.array([1,2,3],ct.c_short)
More complicated:
class POINT(ct.Structure):
_fields_ = [("x", ct.c_int),
("y", ct.c_int)]
np.array([(3,4),(5,6),(7,8)], dtype=POINT)
-Travis
More information about the Numpy-discussion
mailing list