[Numpy-discussion] Array Protocol change for Python 2.6

Sasha ndarray at mac.com
Thu Jun 8 17:07:55 EDT 2006


On 6/8/06, Travis Oliphant <oliphant at ee.byu.edu> wrote:
> ...
> __array_struct__   (perhaps we could call this __array_interface__ but
> I'm happy keeping the name the same too.)

+0 on the name change and consider making it a method rather than an attribute.

>
> 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).
>

-1

This will complicate the use of array interface.  I would propose
creating a subtype of CObject that has the necessary attributes so
that one can do a.__array_interface__.shape, for example.  I did not
check if CObject is subclassable in 2.5, but if not, we can propose to
make it subclassable for 2.6.

> ...
>
> 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).
+1




More information about the NumPy-Discussion mailing list