[Numpy-discussion] Doc on dtypes

Robert Kern robert.kern@gmail....
Mon Jul 14 21:27:25 CDT 2008

On Mon, Jul 14, 2008 at 21:15, Pierre GM <pgmdevlist@gmail.com> wrote:
> On Monday 14 July 2008 21:56:47 Robert Kern wrote:
>> > Oh, with dtype.names and dtype.fields I can work. The Guide mentions a
>> > key [-1] in dtype.fields that should store the names in order: that would
>> > be quite useful but it doesn't work (KeyError).
>> Where do you see this mention?
> Page 116 of my version (once again, 07/17/2006)
> """
> An ordered (by offset) list of field names is also stored in the fields
> dictionary under the key -1. This can be used to walk through all of the
> named fields in offset order. Notice that the defined fields do not have
> to "cover" the record, but the itemsize of the container data-type object
> must always be at least as large as the itemsizes of the data-type objects in
> the defined fields.
> """

I have a slightly newer version of the book. The majority of this text
appears verbatim under the description of dtype.names, so I assume
dtype.fields[-1] got removed in favor of dtype.names. As well it

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco

More information about the Numpy-discussion mailing list