Python 3 中的 sys.maxint 是什么? [英] What is sys.maxint in Python 3?
问题描述
我一直试图找出如何表示最大整数,并且我已经阅读使用 "sys.maxint"
.但是,在 Python 3 中,当我调用它时,我得到:
I've been trying to find out how to represent a maximum integer, and I've read to use "sys.maxint"
. However, in Python 3 when I call it I get:
AttributeError: module 'object' has no attribute 'maxint'
推荐答案
sys.maxint 常量被移除,因为不再有限制到整数值.但是, sys.maxsize 可以用作大于任何实际列表或字符串索引的整数.它符合实现的自然"整数大小,通常是相同的作为同一平台上以前版本中的 sys.maxint(假设相同的构建选项).
The sys.maxint constant was removed, since there is no longer a limit to the value of integers. However, sys.maxsize can be used as an integer larger than any practical list or string index. It conforms to the implementation’s "natural" integer size and is typically the same as sys.maxint in previous releases on the same platform (assuming the same build options).
http://docs.python.org/3.1/whatsnew/3.0.html#整数
这篇关于Python 3 中的 sys.maxint 是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!