[triangle-zpug] why is this using a lot of memory?
David Handy
david at handysoftware.com
Tue Mar 25 15:48:29 UTC 2008
On Tue, Mar 25, 2008 at 08:23:56AM -0700, Joseph Mack NA3T wrote:
> intervals=10000000 #some large number
> height=0
> for x in range(0, intervals):
> height+=x
range() constructs a list in memory, populating the entire thing with each
successive integer.
Try xrange() instead, that's what you want.
David H
--
David Handy
Computer Programming is Fun!
Beginning Computer Programming with Python
http://www.handysoftware.com/cpif/
More information about the triangle-zpug
mailing list