how many bytes in an int

Grant Edwards grante at
Mon Aug 9 20:03:49 CEST 2004

On 2004-08-09, Richard Brodie <R.Brodie at> wrote:
>"Grant Edwards" <grante at> wrote in message
>>By guessing formats and calculating sizes? Or is there a way to
>>ask for an N-byte integer that I missed?
> If you use '<' or '>' to force endianness you automatically
> get 'standard' sizes thrown in; or you can use '=' for native
> order. The standard sizes are specified in the struct module
> documentation.

Doh!  I don't know how many times I've read that without
realizing what it meant.  If you specify byte order explicitly
you _do_ get guaranteed lengths.

Grant Edwards                   grante             Yow!  ... I want FORTY-TWO
                                  at               TRYNEL FLOATATION SYSTEMS
                                 installed withinSIX AND A
                                                   HALF HOURS!!!

More information about the Python-list mailing list