struct.calcsize() giving odd results - Solved

John Purser NO_SPAM_jmpurser2 at attbi.com
Tue Mar 12 20:45:44 EST 2002


Grant,

That got it.  Thanks it was driving me nuts.  Time to go back and RTFM some
more.

John Purser


"Grant Edwards" <grante at visi.com> wrote in message
news:W_vj8.20309$N7.4753798 at ruti.visi.com...
> In article <3Rvj8.27781$af7.23161 at rwcrnsc53>, John Purser wrote:
>
> [regarding struct size that isn't what he wants]
>
> > And that's it.  I tucked this into a variable (fmt) and ran it through
> > struct.calcsize(fmt) and got 190.  I assumed I'd made a typo so I went
over
> > my string.  No problems there.  So I assumed I added it up wrong in the
> > first place.  Nope, 180 bytes.
>
> By default, struct will use the alignment/packing conventions
> used by the native C compiler.  If you want something else,
> you've got to specify it.
>
> Try adding a "=" to the front of your format string.
>
> --
> Grant Edwards                   grante             Yow!  ALFRED JARRY! Say
>                                   at               something about th'
DEATH
>                                visi.com            of DISCO!!





More information about the Python-list mailing list