sys.maxint returns a value corresponding to a 32 bit system even though I am using a 64 bit

巧了我就是萌 提交于 2019-12-13 19:17:44

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!