能有多大一个Python阵列获取? [英] How Big can a Python Array Get?
问题描述
在Python中,
能有多大的数组/列表中得到什么?我需要12000元大数组是......好吗? - 将我仍然能够运行阵列/列表的方法,如排序等
how big can an array/list get? I need an array about 12000 elements large... is that okay? - will I still be able to run array/list methods such as sorting, etc?
太感谢了,
埃德
Thanks so much, Ed
推荐答案
按照<一个href=\"http://svn.python.org/view/python/trunk/Objects/listobject.c?revision=69227&view=markup\">source code ,列表的最大尺寸为 PY_SSIZE_T_MAX /的sizeof(*的PyObject)
。
According to the source code, the maximum size of a list is PY_SSIZE_T_MAX/sizeof(PyObject*)
.
PY_SSIZE_T_MAX
在pyport.h为((为size_t)-1)&GT;&GT; 1
在常规的32位系统中,这是(4294967295/2)/ 4或536870912
On a regular 32bit system, this is (4294967295 / 2) / 4 or 536870912.
因此在32位系统上一个Python列表的最大规模的 536,870,912 元素。
Therefore the maximum size of a python list on a 32 bit system is 536,870,912 elements.
只要有元件的数目是等于或低于此,所有列表函数应该正确操作
As long as the number of elements you have is equal or below this, all list functions should operate correctly.
这篇关于能有多大一个Python阵列获取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!