7.2.3.1 says, shortly after the first table:On Sun, Feb 26, 2012 at 15:09, Paul Moore <p.f.moore@gmail.com> wrote:
On 26 February 2012 12:34, Eli Bendersky <eliben@gmail.com> wrote:
> On Sun, Feb 26, 2012 at 12:33, pmon mail <pmon.mail@gmail.com> wrote:
>> Documentation clearly states that the 'L' is a 4 byte integer.As the OP points out, the documentation says that the "Standard Size"
>>
>> Is this a bug? I'm I missing something?
>>
>
> By default pack uses native size, not standard size. On a 64-bit machine:
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.
"Native size and alignment are determined using the C compiler’s sizeof expression. This is always combined with native byte order.
Standard size depends only on the format character; see the table in the Format Characters section.
"
To me this appears to be a reasonable definition of what "standard size" is.
7.3.2.2 says before the size table:
"Format characters have the following meaning; the conversion between C and Python values should be obvious given their types. The ‘Standard size’ column refers to the size of the packed value in bytes when using standard size; that is, when the format string starts with one of '<', '>', '!' or '='. When using native size, the size of the packed value is platform-dependent."
Again, taken together with the previous quote, IMHO this defines the difference between standard and native sizes clearly. If you feel differently, feel free to open an issue suggesting a better explanation.
Eli