[Numpy-discussion] record array with array elements

Igor Sylvester igorsyl@gmail....
Tue Jan 6 14:15:07 CST 2009


A simpler example returns 1 as well:

np.dtype( [ (((2,), 'a'), 'i1') ] ).itemsize

On Tue, Jan 6, 2009 at 2:07 PM, Igor Sylvester <igorsyl@gmail.com> wrote:

> Everyone,
>
> Shouldn't the itemsize below be 2?
>
> >>> import numpy as np
> >>> dtype = np.dtype( [ (((2,), 'top'), [('nested', 'i1')]) ] )
> >>> dtype.itemsize
> 1
> >>> np.__version__
> '1.0.4'
>
> The elements of the dtype are of type array of size 2.  Each element is a
> (nested) record array of size 2 with one field of type 'i1'.  In contiguous
> memory, this should look identical to an 'i1' array of size 2.
>
> -Igor Sylvester
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20090106/b2f096ed/attachment.html 


More information about the Numpy-discussion mailing list