[Numpy-discussion] Re: Bytes Object and Metadata

David M. Cooke cookedm at physics.mcmaster.ca
Wed Mar 30 13:06:42 EST 2005

Francesc Altet <faltet at 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.

|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca

More information about the NumPy-Discussion mailing list