[Numpy-discussion] PyArray_DescrConverter - alignment / trailingunused bytes

Martin Wiechert martin.wiechert at gmx.de
Fri Sep 15 10:56:37 CDT 2006


On Friday 15 September 2006 17:53, Albert Strasheim wrote:
> 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>
>

Thanks Albert! Do you also know the corresponding C-API function? It cannot be 
PyArray_DescrConverter (PyObject *, PyArray_Descr **), whose signature has no 
"align", right?

> 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
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion




More information about the Numpy-discussion mailing list