[Python-ideas] Struct format with multiple endianness markers

Guido van Rossum guido at python.org
Tue Jul 22 02:54:55 CEST 2014


Simple and elegant. Can you submit a patch? One suggestion: disallow
endianness marker if there isn't one at the start (i.e. default).
On Jul 21, 2014 5:44 PM, "Greg Ewing" <greg.ewing at canterbury.ac.nz> wrote:

> I'd like to propose a small enhancement to the
> struct module: Allow the endianness characters to
> occur more than once in the format string,
> rather than just as the first character.
>
> My use case is reading ESRI shapefile headers, which
> mix big and little endian data. This means I can't
> use a single struct.unpack call to read what is
> logically a single structure, but have to split it
> up and use multiple calls.
>
> If I could switch endianness part way through
> the format, I could unpack the whole structure
> with a single call.
>
> --
> Greg
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140721/00388217/attachment.html>


More information about the Python-ideas mailing list