Is there no compression support for large sized strings in Python?

Harald Karner harald_karner at a1.net
Thu Dec 1 17:52:40 CET 2005


Claudio Grondi wrote:
> Anyone on a big Linux machine able to do e.g. :
>   \>python -c "print len('m' * 2500*1024*1024)"
> or even more without a memory error?

I tried on a Sun with 16GB Ram (Python 2.3.2)
seems like 2GB is the limit for string size:

 > python -c "print len('m' * 2048*1024*1024)"
Traceback (most recent call last):
   File "<string>", line 1, in ?
OverflowError: repeated string is too long

 > python -c "print len('m' * ((2048*1024*1024)-1))"
2147483647



More information about the Python-list mailing list