[Numpy-discussion] Documentation for dtypes with named fields

Sam Tygier Sam.Tygier@hep.manchester.ac...
Tue Mar 16 10:20:02 CDT 2010

Thanks for those responses.

could the dtype pages in the numpy reference link to the basics.rec page in the user guide?

there seem to be some gotchas in list within a list notation.

if i have
a = array([0,0.1,0.2,0.3,0.4])
b =  array((0,0.1,0.2,0.3,0.4), dtype=[('a','f'), ('b','f'), ('c','f'), ('d','f'),('f','f')])

>>> a[[0,1,4]]
array([ 0. ,  0.1,  0.4])
>>> a[[4,1,0]]
array([ 0.4,  0.1,  0. ])

>>> b[['a','b','f']]
(0.0, 0.10000000149011612, 0.40000000596046448)
>>> b[['f','b','a']]
(0.0, 0.10000000149011612, 0.40000000596046448)

so i always get the vales back in the original order. is the by design, or a bug?



More information about the NumPy-Discussion mailing list