July 1, 2003
7:14 a.m.
Robin Becker wrote:
sizeofint = struct.calcsize("i")
well if I wish to store 4 bits/int then this works
s/bits/bytes calcsize returns the number of 8-bit characters the format string needs to store the given C types.
import struct print struct.calcsize("i")
4
but I assume we can store more than 4 bits per int, so waht tells us we cans store 8 bits/struct unit?
characters map to 8 bits == 1 byte and it's rather unlikely that a C compiler will use a different mapping any time soon. -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Jul 01 2003)
Python/Zope Products & Consulting ... http://www.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/