On 03/08/2015 19:15, Dima Kulik wrote:
Hi to all.
Can you help me plz.
I want to make a for loop with a huge numbers.
for example:
for i in range (0,9000000000):
make_some_code
but range and xrange cant operate with such big numbers.
Can some on help me?
Thanks.
You cannot do anything about it directly with Python 2 but this works
fine on Python 3. Work arounds from
http://stackoverflow.com/questions/9816603/range-is-too-large-python are:-
import itertools
range = lambda stop: iter(itertools.count().next, stop)
OR
def range(stop):
i = 0
while i < stop:
yield i
i += 1
Having said that what are you trying to achieve? If you tell us we may
be able to suggest a cleaner solution.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor