Re: Problem with unpack hex to decimal

2005-04-18 Thread [EMAIL PROTECTED]
Thank you all very much. It looked like I was not the only one confused. Jake. -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with unpack hex to decimal

2005-04-17 Thread Artie Gold
Jonathan Brady wrote: <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello, I was looking at this: http://docs.python.org/lib/module-struct.html and tried the following import struct struct.calcsize('h') 2 struct.calcsize('b') 1 struct.calcsize('bh') 4 I would have expected struct.

Re: Problem with unpack hex to decimal

2005-04-17 Thread John Machin
On Sun, 17 Apr 2005 20:47:20 +0100, "Jonathan Brady" <[EMAIL PROTECTED]> wrote: > ><[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> Hello, >> >> I was looking at this: >> http://docs.python.org/lib/module-struct.html >> and tried the following >> > import struct > struct.ca

Re: Problem with unpack hex to decimal

2005-04-17 Thread Peter Hansen
Jonathan Brady wrote: ... I also find the following confusing: struct.calcsize('hb') 3 struct.calcsize('hb') == struct.calcsize('bh') False I could understand aligning to multiples of 4, but why is 'hb' different from 'bh'? Pad bytes have never been, as far as I know, added at the end of structs

Re: Problem with unpack hex to decimal

2005-04-17 Thread Jonathan Brady
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I was looking at this: > http://docs.python.org/lib/module-struct.html > and tried the following > import struct struct.calcsize('h') > 2 struct.calcsize('b') > 1 struct.calcsize('bh') > 4 > > I would hav

Re: Problem with unpack hex to decimal

2005-04-17 Thread Fredrik Lundh
"[EMAIL PROTECTED]" wrote: I was looking at this: http://docs.python.org/lib/module-struct.html and tried the following import struct struct.calcsize('h') 2 struct.calcsize('b') 1 struct.calcsize('bh') 4 I would have expected struct.calcsize('bh') 3 what am I missing ? the sentence "By default,

Problem with unpack hex to decimal

2005-04-17 Thread [EMAIL PROTECTED]
Hello, I was looking at this: http://docs.python.org/lib/module-struct.html and tried the following >>> import struct >>> struct.calcsize('h') 2 >>> struct.calcsize('b') 1 >>> struct.calcsize('bh') 4 I would have expected >>> struct.calcsize('bh') 3 what am I missing ? Thanks in advance, Jak