pataphor pataphor at
Tue Feb 12 10:38:53 CET 2008

On Mon, 11 Feb 2008 23:52:31 -0800
Michael Robertson <mcrobertson at> wrote:

> Am I wishing on a star?
for i in xrange(10**10):
    print i
OverflowError: long int too large to convert to int

The problem seems to be that although python supports arbitrary long
integers, all the internal loop counters still use limited size integers.

I'm not arguing that any program would conceivably finish the above
loop in a reasonable time, but I think it should be possible to use
itertools.islice to get a smaller slice of this iterator (somewhere in
the middle) and iterate on that. Maybe it could be done with something
like "from __future__ import use_long_integers".


More information about the Python-list mailing list