Gabriele Brambilla wrote:
> I have this script
> points = 33750000000
> for iw in range(points):
> print iw
> But when I run it it is killed in the for cycle, it doesn't print any
> [gabriele:~/Desktop/GITcode] gbrambil% python EknotFromKostas.py
> im here
> does it mean that my number of points is too high?
In Python 2 range(points) creates a list. To store only the object
references in the list (the actual int object takes much more memory) you
>>> 33750000000 * 8
>>> _ / 2**30
i. e. over 250 GiB of RAM on a 64 bit system.
While you can replace range() with xrange() in Python 2 or switch to Python
3 where range() is an object
you should start with much smaller numbers and then extrapolate the expected
runtime and memory consumption of your script once it does anything useful.
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options: