how best to iterate i times ?
mike at nospam.com
Wed Mar 17 20:25:55 CET 2004
Randall Smith wrote:
> for i in range(100000):
> I like how clean this syntax is, but this method is very wasteful.
> The list created by range(100000) consumes a fair amount of memory
> and it is only used to iterate.
> So, question is: What is the efficient, elegant, pythonic way to
> iterate with integers?
Solely for that purpose 'xrange' was created:
for i in xrange(100000):
More information about the Python-list