`xrange (2 ** 100)` -> OverflowError: long int muito grande para converter para int
xrange
função não funciona para inteiros grandes:
>>> N = 10**100
>>> xrange(N)
Traceback (most recent call last):
...
OverflowError: long int too large to convert to int
>>> xrange(N, N+10)
Traceback (most recent call last):
...
OverflowError: long int too large to convert to int
Python 3.x:
>>> N = 10**100
>>> r = range(N)
>>> r = range(N, N+10)
>>> len(r)
10
Existe um backport de py3k builtinrange()
função para Python 2.x?
Eu estou procurando uma implementação completa de "preguiçoso"range()
, não apenas uma implementação parcial de algumas das suas funcionalidades.