[Python-Dev] Expose the array interface in Python 2.5? (original) (raw)

Thomas Heller theller at python.net
Fri Mar 17 20:55:58 CET 2006


Travis E. Oliphant wrote:

Last year, during development of NumPy, the concept of the array interface was developed as a means to share arraylike data. It was realized that it is this concept that needs to be explored further and pushed into Python itself, rather than a particular incarnation of an array.

It is very important for many people to get access to memory with some description of how that memory should be interpreted as an array. Several Python packages could benefit if Python had some notion of an array interface that was at least supported in a duck-typing fashion. The description of what we've come up with so far and is implemented in NumPy (and Numarray and last released Numeric) is at http://numeric.scipy.org/#arrayinterface Quite a few of us would love to see this get into Python proper, but have very little free-time to spare to make sure it happens. Would it be possible to add at least the C-struct array interface to the Python arrayobject in time for Python 2.5?

I'm very much for that.

Is someone on this list willing to help make it happen?

Unfortunately not me - I'm too busy with ctypes, and if the array interface makes it into the core I will have to implement/use that in ctypes too. Accessing Python arrays (Numeric arrays, Numeric array, or Numpy array) as ctypes arrays, and vice versa, without copying any memory, would be a good thing.

In NumPy, there is also a reasonably good way to describe the "data-type" of arbitrary data, that fell out of the discussions over the array interface. I think something like this could eventually find its way into Python as well.

We would love any feedback from the Python community on the array interface. Especially because we'd like to see it in Python itself and supported and used by every relevant Python package sooner rather than later.

Thomas



More information about the Python-Dev mailing list