Author pv
Recipients Alexander.Belopolsky, MrJean1, ajaksu2, barry, benjamin.peterson, inducer, mark.dickinson, meador.inge, noufal, pitrou, pv, teoliphant
Date 2010-12-02.18:14:17
SpamBayes Score 6.88046e-08
Marked as misclassified No
Message-id <1291313659.05.0.620420958782.issue3132@psf.upfronthosting.co.za>
In-reply-to
Content
For reference, Numpy's PEP 3118 implementation is here:

http://github.com/numpy/numpy/blob/master/numpy/core/_internal.py#L357

http://github.com/numpy/numpy/blob/master/numpy/core/src/multiarray/buffer.c#L76

It would be a good idea to ensure that the numpy and struct implementations are in agreement about details of the format strings.
(I wouldn't take the Numpy implementation as the definitive one, though.)

- The "sub-structs" in Numpy arrays (in align=True mode) are aligned
  according to the maximum alignment of the fields.

- I assumed the 'O' format in the PEP is supposed to be similar to Numpy
  object arrays. This implies some reference counting semantics. The
  Numpy PEP 3118 implementation assumes the memory contains borrowed
  references, valid at least until the buffer is released.
  Unpacking 'O' should probably INCREF whatever PyObject* pointer is
  there.

- I assumed the alignment specifiers were unscoped. I'm not sure
  however whether this is the best thing to do.

- The function pointers and pointers to pointers were not implemented.
  (Numpy cannot represent those as data types.)
History
Date User Action Args
2010-12-02 18:14:19pvsetrecipients: + pv, barry, teoliphant, mark.dickinson, pitrou, inducer, ajaksu2, MrJean1, benjamin.peterson, noufal, meador.inge, Alexander.Belopolsky
2010-12-02 18:14:19pvsetmessageid: <1291313659.05.0.620420958782.issue3132@psf.upfronthosting.co.za>
2010-12-02 18:14:17pvlinkissue3132 messages
2010-12-02 18:14:17pvcreate