Showing content from http://mail.python.org/pipermail/python-dev/attachments/20120226/e960efab/attachment.html below:
<div dir="ltr"><br><br><div class="gmail_quote">On Sun, Feb 26, 2012 at 15:09, Paul Moore <span dir="ltr"><<a href="mailto:p.f.moore@gmail.com">p.f.moore@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 26 February 2012 12:34, Eli Bendersky <<a href="mailto:eliben@gmail.com">eliben@gmail.com</a>> wrote:<br>
> On Sun, Feb 26, 2012 at 12:33, pmon mail <<a href="mailto:pmon.mail@gmail.com">pmon.mail@gmail.com</a>> wrote:<br>
</div><div class="im">>> Documentation clearly states that the 'L' is a 4 byte integer.<br>
>><br>
>> Is this a bug? I'm I missing something?<br>
>><br>
><br>
> By default pack uses native size, not standard size. On a 64-bit machine:<br>
<br>
</div>As the OP points out, the documentation says that the "Standard Size"<br>
is 4 bytes (<a href="http://docs.python.org/library/struct.html" target="_blank">http://docs.python.org/library/struct.html</a>). While<br>
"Standard Size" doesn't appear to be defined in the documentation, and<br>
the start of the previous section (7.3.2.1. Byte Order, Size, and<br>
Alignment) clearly states that C types are represented in native<br>
format by default, the documentation could probably do with some<br>
clarification.<br>
<span class="HOEnZb"></span><br></blockquote></div><br>7.2.3.1 says, shortly after the first table:<br><br>"
<p>Native size and alignment are determined using the C compilers
<tt class="docutils literal"><span class="pre">sizeof</span></tt> expression. This is always combined with native byte order.</p>
<p>Standard size depends only on the format character; see the table in
the <a class="reference internal" href="http://docs.python.org/library/struct.html#format-characters"><em>Format Characters</em></a> section.</p>"<br><br>To me this appears to be a reasonable definition of what "standard size" is. <br>
<br>7.3.2.2 says before the size table:<br><br>"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 <tt class="docutils literal"><span class="pre">'<'</span></tt>, <tt class="docutils literal"><span class="pre">'>'</span></tt>, <tt class="docutils literal"><span class="pre">'!'</span></tt> or
<tt class="docutils literal"><span class="pre">'='</span></tt>. When using native size, the size of the packed value is
platform-dependent."<br><br>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.<br>
<br>Eli<br><br><br><br></div>
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4