
Are there standard ways to determine things like wordlength etc in distutils? I suppose one can use sys.maxint, but I thought this might be a standard kind of requirement now that we're slipping from 32 to 64 bits. -- Robin Becker

Robin Becker wrote:
I'd use the struct module for these things. -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Jun 29 2003)
Python/Zope Products & Consulting ... http://www.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/

Robin Becker wrote:
sizeofint = len(struct.pack('i',1)) -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Jun 29 2003)
Python/Zope Products & Consulting ... http://www.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/

Jeremy Hylton wrote:
Even better :-) -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Jun 30 2003)
Python/Zope Products & Consulting ... http://www.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/

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.
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/

In article <3F0134E4.10907@lemburg.com>, M.-A. Lemburg <mal@lemburg.com> writes ......
characters map to 8 bits == 1 byte and it's rather unlikely that a C compiler will use a different mapping any time soon.
that's what I thought, but it's wise to be sure, and though I suppose there are few Pdp-18's or CDC 6000's running these days, it doesn't seem unreasonable given the changes over the last 20 years that unicode of 16/32 bits might become more acceptable as a 'char unit'. -- Robin Becker

Robin Becker wrote:
I'd use the struct module for these things. -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Jun 29 2003)
Python/Zope Products & Consulting ... http://www.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/

Robin Becker wrote:
sizeofint = len(struct.pack('i',1)) -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Jun 29 2003)
Python/Zope Products & Consulting ... http://www.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/

Jeremy Hylton wrote:
Even better :-) -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Jun 30 2003)
Python/Zope Products & Consulting ... http://www.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/

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.
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/

In article <3F0134E4.10907@lemburg.com>, M.-A. Lemburg <mal@lemburg.com> writes ......
characters map to 8 bits == 1 byte and it's rather unlikely that a C compiler will use a different mapping any time soon.
that's what I thought, but it's wise to be sure, and though I suppose there are few Pdp-18's or CDC 6000's running these days, it doesn't seem unreasonable given the changes over the last 20 years that unicode of 16/32 bits might become more acceptable as a 'char unit'. -- Robin Becker
participants (3)
-
Jeremy Hylton
-
M.-A. Lemburg
-
Robin Becker