[Numpy-discussion] PyArray_DescrConverter - alignment / trailingunused bytes

Albert Strasheim fullung at gmail.com
Fri Sep 15 10:53:11 CDT 2006


Hello all

In [1]: import numpy as N

In [3]: N.dtype({'names' : ['x', 'y'],
                 'formats' : [N.intc, N.float64]},
                align=True)
Out[3]: dtype([('x', '<i4'), ('', '|V4'), ('y', '<f8')])

The reason you might not have discovered this:

In [2]: N.dtype?
Type:           type
Base Class:     <type 'type'>
String Form:    <type 'numpy.dtype'>
Namespace:      Interactive
File:           c:\python24\lib\site-packages\numpy\__init__.py
Docstring:
    <no docstring>

Cheers,

Albert

> -----Original Message-----
> From: numpy-discussion-bounces at lists.sourceforge.net [mailto:numpy-
> discussion-bounces at lists.sourceforge.net] On Behalf Of Martin Wiechert
> Sent: 15 September 2006 16:14
> To: numpy-discussion
> Subject: [Numpy-discussion] PyArray_DescrConverter - alignment /
> trailingunused bytes
> 
> Hi list,
> 
> I'm using PyArray_DescrConverter with a dict object to create a "struct-
> like"
> dtype from C.
> As the struct contains different data types I run into "unaligned access"
> problems.
> Is there a way to force alignment or to get trailing unused bytes in the
> dtpye?
> 
> Thanks, Martin





More information about the Numpy-discussion mailing list