David M. Cooke wrote:
Francesc Altet <faltet@carabos.com> writes:
A Dimarts 29 Març 2005 01:59, Travis Oliphant va escriure:
My proposal:
__array_data__ (optional object that exposes the PyBuffer protocol or a sequence object, if not present, the object itself is used). __array_shape__ (required tuple of int/longs that gives the shape of the array) __array_strides__ (optional provides how to step through the memory in bytes (or bits if a bit-array), default is C-contiguous) __array_typestr__ (optional struct-like string showing the type --- optional endianness indicater + Numeric3 typechars, default is 'V') __array_itemsize__ (required if above is 'S', 'U', or 'V') __array_offset__ (optional offset to start of buffer, defaults to 0)
Considering that heterogenous data is to be suported as well, and there is some tradition of assigning names to the different fields, I wonder if it would not be good to add something like:
__array_names__ (optional comma-separated names for record fields)
A sequence (list or tuple) of strings would be preferable. That removes all worrying about using commas in the names.
As I understand it, record arrays can be heterogenous. If so, wouldn't it make sense for this to be a sequence of tuples? For example: [('Name', charStringType), ('Age', _nt.Int8), ...] Where _nt is defined by something like: import numarray.numerictypes as _nt Colin W.