[Python-Dev] struct.pack inconsistencies between platforms

Paul Moore p.f.moore at gmail.com
Sun Feb 26 14:09:33 CET 2012


On 26 February 2012 12:34, Eli Bendersky <eliben at gmail.com> wrote:
> On Sun, Feb 26, 2012 at 12:33, pmon mail <pmon.mail at gmail.com> wrote:
>> Documentation clearly states that the 'L' is a 4 byte integer.
>>
>> Is this a bug? I'm I missing something?
>>
>
> By default pack uses native size, not standard size. On a 64-bit machine:

As the OP points out, the documentation says that the "Standard Size"
is 4 bytes (http://docs.python.org/library/struct.html). While
"Standard Size" doesn't appear to be defined in the documentation, and
the start of the previous section (7.3.2.1. Byte Order, Size, and
Alignment) clearly states that C types are represented in native
format by default, the documentation could probably do with some
clarification.

Paul.


More information about the Python-Dev mailing list