Gregory P. Smith added the comment:
the docs I see in the URL you give are correct as it states 'two and
four byte unsigned integer respectively' for H and L. However the
example is missing the for little-endian; I'll add that.
Also, I notice that the struct module documentation itself
Christopher Yeleighton added the comment:
Python 2.5.1 (r251:54863, Oct 5 2007, 13:50:07)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type help, copyright, credits or license for more information.
import struct
g_f = open('/dev/null')
struct.unpack('L',
Gregory P. Smith added the comment:
eew, so the struct module does map as documented to the C types listed
in the docs. yuck. regardless, changing the Ls to Is will fix the
tutorial document code. I'll do that.
I believe there are also other instances of wrong uses of L in struct in
the code
Gregory P. Smith added the comment:
The documentation for the struct module says:
short is 2 bytes; int and long are 4 bytes; long long (__int64 on
Windows) is 8 bytes
and lists 'l' and 'L' as the pack code for a C long.
As it is implemented today, the documentation is incorrect. On an LP64