[issue3132] implement PEP 3118 struct changes

Stefan Krah report at bugs.python.org
Wed Apr 13 06:20:08 EDT 2016


Stefan Krah added the comment:

Here's a grammar that roughly describes the subset that NumPy supports.

As for implementing this in the struct module: There is a new data
description language on the horizon:

  http://datashape.readthedocs.org/en/latest/


It does not have all the low-level capabilities (e.g changing alignment
on the fly), but it is far more readable. Example:

PEP-3118:  "(2,3)10f0fZdT{10B:x:(2,3)d:y:Q:z:}B"
Datashape: "2 * 3 * (10 * float32, 0 * float32, complex128, {x: 10 * uint8, y: 2 * 3 * float64, z: int64}, uint8)"


There are a lot of open questions still. Should "10f" be viewed as an
array[10] of float, i.e. equivalent to (10)f?

In the context of PEP-3118, I think so.

----------
nosy: +skrah
Added file: http://bugs.python.org/file42451/grammar.y

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3132>
_______________________________________


More information about the Python-bugs-list mailing list