[Numpy-discussion] Array Protocol change for Python 2.6

Tim Hochberg tim.hochberg at cox.net
Fri Jun 9 17:49:12 CDT 2006

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

A possibly related point, array_interface['data'] should be required to 
be a buffer object; a 2-tuple of address/read-only should not be allowed 
as that's a simple way to crash the interpreter.

I see some reasonable arguments for either 1 or 2. 3 seems like excess work.


More information about the Numpy-discussion mailing list