[Numpy-discussion] Properties of fields in numpy

Francesc Altet faltet at carabos.com
Mon Feb 6 11:06:02 CST 2006


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

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

although for this to be complete one should add a 'shape' attribute to

In [147]:dtype.fields['x'][0].shape

In fact, this information is already contained in dtype container:

In [148]:dtype.fields['x'][0]

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