how many bytes in an int

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


On 2004-08-09, Richard Brodie <R.Brodie at rl.ac.uk> wrote:
>"Grant Edwards" <grante at visi.com> 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
                               visi.com            installed withinSIX AND A
                                                   HALF HOURS!!!



More information about the Python-list mailing list