问题
I am not very knowledgeable about system architecture, and have just started learning Python.
In one of the tutorial videos it was mentioned that running sys.maxint in the interpreter will return the biggest integer that is available to you.
It was also mentioned that 2147483647 is the integer that corresponds to a 32 bit system. That's is the integer that I am being returned when I run sys.maxint.
I am using Enthought Canopy (64 bit) on a 64 bit OS. Windows 8, to be precise.
Is there any way I can increase the sys.maxint value to one that corresponds a 64 bit machine?
回答1:
Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import platform
>>> platform.architecture()
>>> ('64bit', 'WindowsPE')
>>> import sys
>>> sys.maxint
>>> 2147483647
>>> sys.maxint+1
>>> 2147483648L
Seems to be a limitation on Windows.
I would not worry about it, as Python supports bignums and won't overflow. Although performance will be lower if you exceed sys.maxint
.
来源:https://stackoverflow.com/questions/28910951/sys-maxint-returns-a-value-corresponding-to-a-32-bit-system-even-though-i-am-usi