MemoryError under 2.2b1
michael at rcp.co.uk
Fri Nov 2 13:29:52 CET 2001
"wtr" <wtri at wtresearch.de> wrote in news:1004688073.78898 at lix-049dz-
> The following little script ends in a MemoryError
> hello world!
> Traceback (most recent call last):
> File "C:/Python22/HelloWorld.py", line 4, in ?
> for j in range(99999999,1000000001):
> There seems to be a strange dependancy between the two range parameters;
> ranges (99999999,100000000) and (999999999,1000000099) work.
1000000001 - 99999999 = 900000002
100000000 - 99999999 = 1
1000000099 - 999999999 = 100
Another clue: range() allocates the entire list before returning (you might
prefer to use xrange() if appropriate).
Allocating a list containing 900000002 entries uses at least 3.6GB. If
your machine could handle this I'd be mightily impressed!
More information about the Python-list