From: Fernando P. <fpe...@gm...> - 2006-06-17 15:27:45
|
On 6/17/06, Francesc Altet <fa...@ca...> wrote: > However, I think that this has its utility, specially when accessing to > nested fields (see later). In addition, I'd suggest introducing a > special accessor called, say, 'fields' in order to access the fields > themselves and not the attributes. For example, if you want to access > the 'strides' attribute, you can do it in the usual way: > > >>> import numpy > >>> tr=numpy.recarray(10, formats='i4,f8,f8', names='id,ra,strides') > >>> tr.strides > (20,) > > but, if you want to access *field* 'strides' you could do it by issuing: > > >>> tr.fields.strides > <repr of field accessor object (shape, type...)> > >>> tr.fields.strides[:] > array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]) [...] +1 I meant to write exactly the same thing, but was too lazy to do it :) Cheers, f |