[Numpy-discussion] Ctypes support in NumPy

Thomas Heller theller at python.net
Tue Jul 4 07:49:42 EDT 2006


Albert Strasheim schrieb:
> Hey Thomas
> 
> Thomas Heller wrote:
>> Thomas Heller schrieb:
>> > I've also played a little, and I think one important limitation in
>> ctypes
>> > is that items in the argtypes list have to be ctypes types.
>> 
>> Thi swas misleading:  I mean that this limitation should probably be
>> removed, because it prevents a lot of things one could do.
> 
> What's your thinking on getting these changes made to ctypes and on ctypes'
> future development in general?
> 
> Presumably you can't change it too much with the Python 2.5 release coming
> up, but it would be a shame if we had to wait until Python 2.6 to get the
> changes you suggested (and other goodies, like the array interface).

I have asked on python-dev, let's wait for the answer.
I hope that at least the limitation that I mentioned can be removed in Python 2.5.

The goal of my post was to show that (without this restriction) a lot can
already be done in Python, of course it would be better if this could be
implemented in C and integrated in ctypes.

For the numpy/ctypes inegration I'm not absolutely sure what would be needed most:

Is there a need to convert between ctypes and numpy arrays?  If numpy arrays can
be passed to ctypes foreign functions maybe there is no need at all for the conversion.
We could probably even live with helper code like that I posted outside of ctypes...

Thomas





More information about the NumPy-Discussion mailing list