[Numpy-discussion] Re: Bytes Object and Metadata

Magnus Lie Hetland magnus at hetland.org
Tue Mar 29 13:11:20 EST 2005

Travis Oliphant <oliphant at ee.byu.edu>:
> 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)
> So, you could define an array interface with only two additional 
> attributes if your object exposed the buffer or sequence protocol. 

Wohoo! Niiice :)

(Okay, a bit "me too"-ish, but I just wanted to contribute some
enthusiasm ;)

Magnus Lie Hetland                    Fall seven times, stand up eight
http://hetland.org                                  [Japanese proverb]

More information about the NumPy-Discussion mailing list