Dick Moores <rdm <at> rcblue.com> writes: <snip> > I can think of 2 workarounds for this 2**31 limitation in xrange(). > Use a while loop instead. Or use 2 or more for loops, keeping the > number of cycles in each under 2**31. > > Are there others?
Write your own iterator: >>> def hugerange(minval, maxval): ... val = minval ... while val < maxval: ... yield val ... val += 1 ... >>> for i in hugerange(2**31, 2**31 + 2): ... print i ... 2147483648 2147483649 It might be slower than Python's xrange implementation (haven't tested), but it will take anything you throw at it as long as Python itself can handle it. Yours, Andrei _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor