One way is to look at maxint
:
$ /usr/bin/python2.6
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys; sys.maxint
9223372036854775807
>>> ^D
$ arch -i386 /usr/bin/python2.6
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys; sys.maxint
2147483647
[EDIT] BTW, if you run into a 64-bit universal build of Python3
on OS X, this trick won't work because sys.maxint
has been removed in Python3. However, for Python3
you can use sys.maxsize
instead with the same results. Don't use sys.maxsize
for Python2.6
, though, as it appears not to be dynamically determined. Ugh.