[Numpy-discussion] Properties of fields in numpy
Francesc Altet
faltet at carabos.com
Mon Feb 6 11:06:02 CST 2006
Hi,
I don't specially like the 'void*' typecasting that are receiving the
types in fields in situations like:
In [143]:dtype = numpy.dtype([
.....: ('x', '<i4', (2,)),
.....: ('Info',[
.....: ('name', '<U120'),
.....: ('weight', '<f4')])])
In [147]:dtype.fields['x'][0].name
Out[147]:'void64'
were you can see that we have lost the information about the native type
of the 'x' field. Rather, I'd expect something like:
In [147]:dtype.fields['x'][0].name
Out[147]:'int32'
although for this to be complete one should add a 'shape' attribute to
dtype:
In [147]:dtype.fields['x'][0].shape
Out[147]:(2,)
In fact, this information is already contained in dtype container:
In [148]:dtype.fields['x'][0]
Out[148]:dtype(('<i4',(2,)))
but this is clearly little consistent with the current mapping of the
dtype.fields['x'] attributes.
I strongly feel that this suggested approach makes more sense than the
current one. Thoughts?
--
>0,0< Francesc Altet http://www.carabos.com/
V V Cárabos Coop. V. Enjoy Data
"-"
More information about the Numpy-discussion
mailing list