[Numpy-discussion] Array interface
oliphant at ee.byu.edu
Sun Apr 3 21:29:12 EDT 2005
> Probably. Since, I guess you can only have one of < or > . Thanks..
>> - What are the semantics when __array_typestr__ isn't V[0-9]+ and
>> __array_descr__ is set? Is __array_typestr__ ignored? Or... What
>> would it be used for?
> I would say that the __array_descr__ always gives more information but
> not every array implementation will support looking at it. For
> example, current Numeric (24.0 in CVS) ignores __array_descr__ and
> just looks at the typestr (and doesn't support 'V'). So, I suspect
> that another array package that knows this may choose something else
> besides 'V' if it really wants Numeric to still understand it.
> Suppose you have a complex short int array with
> __array_descr__ = 'V8
Let me finish this example:
Suppose you have a complex short int array with
__array_descr__ = [('real','i2'),('imag','i2')]
you could describe this as
__array_typestr__ = 'V4'
or think of it as a 4 byte integer if you want to make sure that another
array package that may not support void pointers can still manipulate
the data, and so the creator of the complex short int array may decide that
__array_typestr__ = 'i4'
is the right thing to do for packages that ignore the __array_descr__
More information about the NumPy-Discussion