maximum length of a list & tuple
Terry Reedy
tjreedy at udel.edu
Fri Apr 9 13:57:26 EDT 2004
"Lupe" <luis_ at iname.com> wrote in message
news:c55okv$2o3eql$1 at ID-202776.news.uni-berlin.de...
> I just would like to know if there is any limit to a list or tuple.
Theoretically no, practically yes. For computer implementations, one limit
is max int (usually 2billion+). The other, which usually kicks in first,
is RAM memory.
If you nest v e r y deeply, you may also run into a compiler limit or stack
overflow. As an experiment, I tried
t=()
for i in range(100000): t = (t,) # runs fine
print t
...
MemoryError: stack overflow
Feel free to experiment on your own system.
Terry J. Reedy
More information about the Python-list
mailing list