[Numpy-discussion] Array Protocol change for Python 2.6
oliphant at ee.byu.edu
Thu Jun 8 15:26:57 CDT 2006
One of the hopes for the Summer of Code project involving getting the
multidimensional array object into Python 2.6 is advertisement of the
array protocol or array interface.
I think one way to simplify the array protocol is simply have only one
attribute that is looked to to provide access to the protocol. I would
like to deprecate all the array protocol attributes except for
__array_struct__ (perhaps we could call this __array_interface__ but
I'm happy keeping the name the same too.)
If __array_struct__ is a CObject then it behaves as it does now.
If __array_struct__ is a tuple then each entry in the tuple is one of
the items currently obtained by an additional attribute access (except
the first item is always an integer indicating the version of the
protocol --- unused entries are None).
This should simplify the array interface and allow easier future
changes. It should also simplify NumPy so that it doesn't have to check
for multiple attributes on arbitrary objects.
I would like to eliminate all the other array protocol attributes before
NumPy 1.0 (and re-label those such as __array_data__ that are useful in
other contexts --- like ctypes).
More information about the Numpy-discussion