determine 32 or 64 bit architecture with python 2.2

Lenard Lindstrom len-l at telus.net
Tue Jun 19 18:22:09 EDT 2007


David Rushby wrote:
> On Jun 19, 4:28 pm, John Machin <sjmac... at lexicon.net> wrote:
>> On Jun 19, 9:17 pm, Kai Rosenthal <kairosent... at tiscali.de> wrote:
>>
>>> Hello,
>>> how can I determine the architecture (32 or 64bit) with python 2.2 on
>>> Windows or Unix (AIX, Solaris) OS, without the modul platform?
>>> Thanks for your hints, Kai
>> What happens when you fire up a 64-bit Python and type
>>     import sys; sys.maxint
>> at it?
> 
> That's not suitable, because of the differences between LP64 and LLP64
> (http://en.wikipedia.org/wiki/64-bit#64-bit_data_models ).
> 
> Try
>   python -c "import struct; print struct.calcsize('P')"
> instead.  That calculates the size of a pointer.
> 

How about:

tuple.__itemsize__

since each tuple item is a pointer.

--
Lenard Lindstrom
<len-l at telus.net>



More information about the Python-list mailing list