[CentralOH] Python bit size

Eric Floehr eric at intellovations.com
Tue May 10 21:45:24 CEST 2011


Mark,


> Thanks for the reply, but this doesn't appear to work on a Mac with Snow
> Leopard.  Apparently, the default Python that comes with SL is a universal
> binary containing both 32 and 64 bit versions.  By using the arch command or
> setting an environment variable (VERSIONER_PYTHON_PREFER_32_BIT), you can
> force Python to load either as 32 or 64 bit.  I know that I'm getting
> different versions because sys.maxint returns different values (2147483647
> for 32-bit and 9223372036854775807 for 64-bit), but on my Mac
> platform.architecture() always returns ('64bit', ''). I think it's telling
> me that the OS is 64-bit.
>
>
I think your answer is right there (sys.maxint):

def bits():
    import sys
    x = sys.maxint
    n = 1
    while x:
        n += 1
        x >>= 1
    return n

-Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/mailman/private/centraloh/attachments/20110510/8e9331b8/attachment-0001.html>


More information about the CentralOH mailing list