[Numpy-discussion] record array with array elements

Robert Kern robert.kern@gmail....
Tue Jan 6 22:21:15 CST 2009

On Tue, Jan 6, 2009 at 22:04, Igor Sylvester <igorsyl@gmail.com> wrote:
> If array fields should be of the form (name,subdtype, shape), how do I
> specify field offsets? My datatype is word-aligned.

With dtype(some_list), you need to explicitly include the padding.
E.g. ('', '|V4') to add 4 bytes of padding. Alternately, you can use

  names=['x', 'y'],
  formats=['u1', ('u1', (2,2))],
  offsets=[0, 4],

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