struct module
Skip Montanaro
skip at pobox.com
Fri Oct 19 23:53:45 EDT 2001
>> Can someone tell me what I'm missing here?
>>>> struct.calcsize('H')
>> 2
>>>> struct.calcsize('B')
>> 1
>>>> struct.calcsize('HB')
>> 3
>> wait for it...
>>>> struct.calcsize('BH')
>> 4
H has a two-byte alignment requirement. There's one byte for the "B", then
it has to throw in a pad byte to get the correct word alignment for the
"H".
--
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/
More information about the Python-list
mailing list