[Numpy-discussion] Array Protocol change for Python 2.6

Andrew Straw strawman at astraw.com
Fri Jun 9 18:03:32 CDT 2006


Tim Hochberg wrote:

>Which of the following should we require for an object to be "supporting 
>the array interface"? Here a producer is something that supplies 
>array_struct or array_interface (where the latter is the Python level 
>version of the former as per recent messages). Consumers do something 
>with the results.
>
>   1. Producers can supply either array_struct (if implemented in C) or
>      array_interface (if implemented in Python). Consumers must accept
>      both.
>   2. Producers must supply both array_struct and array_interface.
>      Consumers may accept either.
>   3. Producers most supply both array_struct and array_interface.
>      Consumers must accept both as well.
>  
>
I haven't been following as closely as I could, but is the following a 
possibility?
    4. Producers can supply either array_struct or array_interface. 
Consumers may accept either. The intermediate is a small, standalone 
(does not depend on NumPy) extension module that does automatic 
translation if necessary by provides 2 functions: as_array_struct() 
(which returns a CObject) and as_array_interface() (which returns a 
tuple/dict/whatever).




More information about the Numpy-discussion mailing list