[prev in list] [next in list] [prev in thread] [next in thread]
List: python-list
Subject: Re: Problem with unpack hex to decimal
From: "Jonathan Brady" <nospam () denbridgedigital ! com>
Date: 2005-04-17 19:47:20
Message-ID: d3ueer$avn$1$8302bc10 () news ! demon ! co ! uk
[Download RAW message or body]
<serpent17@gmail.com> wrote in message
news:1113763068.002612.240940@l41g2000cwc.googlegroups.com...
> 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 ?
Not sure, however 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'?
--
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic