Message123093
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.) |
|
Date |
User |
Action |
Args |
2010-12-02 18:14:19 | pv | set | recipients:
+ pv, barry, teoliphant, mark.dickinson, pitrou, inducer, ajaksu2, MrJean1, benjamin.peterson, noufal, meador.inge, Alexander.Belopolsky |
2010-12-02 18:14:19 | pv | set | messageid: <1291313659.05.0.620420958782.issue3132@psf.upfronthosting.co.za> |
2010-12-02 18:14:17 | pv | link | issue3132 messages |
2010-12-02 18:14:17 | pv | create | |
|