Re: Struct usage and varying sizes of h, l, etc

2008-05-22 Thread Robert Kern
Ethan Furman wrote: Next question: when using struct.pack to store an integer, I get a deprecation warning if the int is too big... I would rather have an error. Is there a setting somewhere that controls this? http://docs.python.org/dev/library/warnings -- Robert Kern "I have come to bel

Re: Struct usage and varying sizes of h, l, etc

2008-05-22 Thread Ethan Furman
John Machin wrote: Robert Kern wrote: Ethan Furman wrote: Greetings, I'm looking at the struct module for binary packing of ints and floats. The documentation refers to C datatypes. It's been many years since I looked at C, but I seem to remember that the data type sizes were not fixed

Re: Struct usage and varying sizes of h, l, etc

2008-05-21 Thread [EMAIL PROTECTED]
On May 21, 10:04 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > Yes, C defines "char" to be one byte, but it doesn't define the > size of a "byte" other than it's at least big enough to hold > one character (or something like that). In practice, a byte is > pretty much guaranteed to be at least 8

Re: Struct usage and varying sizes of h, l, etc

2008-05-21 Thread Ethan Furman
John Machin wrote: Robert Kern wrote: Ethan Furman wrote: Greetings, I'm looking at the struct module for binary packing of ints and floats. The documentation refers to C datatypes. It's been many years since I looked at C, but I seem to remember that the data type sizes were not fixed

Re: Struct usage and varying sizes of h, l, etc

2008-05-21 Thread Grant Edwards
On 2008-05-20, Robert Kern <[EMAIL PROTECTED]> wrote: >> I'm looking at the struct module for binary packing of ints >> and floats. The documentation refers to C datatypes. It's >> been many years since I looked at C, but I seem to remember >> that the data type sizes were not fixed -- for examp

Re: Struct usage and varying sizes of h, l, etc

2008-05-21 Thread Matthieu Brucher
> > This is all true if you want to operate in "native" mode; however in > "standard" mode the sizes are fixed -- otherwise there'd be no easy way of > reading/writing the fixed-size fields in many common file formats. > > As the manual says: > """ > Native size and alignment are determined using t

Re: Struct usage and varying sizes of h, l, etc

2008-05-21 Thread John Machin
Robert Kern wrote: Ethan Furman wrote: Greetings, I'm looking at the struct module for binary packing of ints and floats. The documentation refers to C datatypes. It's been many years since I looked at C, but I seem to remember that the data type sizes were not fixed -- for example, an int

Re: Struct usage and varying sizes of h, l, etc

2008-05-20 Thread Dan Bishop
On May 20, 5:59 pm, Robert Kern <[EMAIL PROTECTED]> wrote: > Ethan Furman wrote: > > Greetings, > > > I'm looking at the struct module for binary packing of ints and floats.   > > The documentation refers to C datatypes.  It's been many years since I > > looked at C, but I seem to remember that the

Re: Struct usage and varying sizes of h, l, etc

2008-05-20 Thread Robert Kern
Ethan Furman wrote: Greetings, I'm looking at the struct module for binary packing of ints and floats. The documentation refers to C datatypes. It's been many years since I looked at C, but I seem to remember that the data type sizes were not fixed -- for example, an int might be two byes o

Struct usage and varying sizes of h, l, etc

2008-05-20 Thread Ethan Furman
Greetings, I'm looking at the struct module for binary packing of ints and floats. The documentation refers to C datatypes. It's been many years since I looked at C, but I seem to remember that the data type sizes were not fixed -- for example, an int might be two byes on one machine, and fo