[Numpy-discussion] Properties of fields in numpy

Francesc Altet faltet at carabos.com
Tue Feb 7 02:55:10 CST 2006


A Dimarts 07 Febrer 2006 01:08, Travis Oliphant va escriure:
> In SVN of numpy, the dtype objects now have a .base attribute and a
> .shape attribute.
>
> The .shape attribute returns (1,)  or the shape of the sub-array.

Uh, it wouldn't be better to put .shape = 1 in case of a scalar field
and (...) for a non-scalar field? Remember that this is the current
convention for the numpy protocol.

> The .base attribute returns the data-type object of the base-type, or a
> new reference to self, if the object has no base.type.
>
> Thus, in current SVN
>
> dtype['x'].base.name  would always give you what you want.

Great. I like it. Thanks!

-- 
>0,0<   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data
 "-"





More information about the Numpy-discussion mailing list