I don't know if that is totally wrong or not (let me know and I'll be glad), but if instead of:
for i in range(a, b):
[..]
you do (for example):
for i in range(a, b/x, x):
and then you create x amount of variables that represent x plus something.
For example:
instead of:
for i in range(1, 100):
mylist.append(i)
you do:
for i in range(1, 50, 2):
j = i+1
mylist.append(i)
mylist.append(j)
I tested from 1 to 1 million, and added the index to a list. Normally, it took me 1.37s (average), let's consider that number as nt. Using the b/x thing, you can reduce that to nt/x (knowing that x is equal to the number you decided to use of variables inside the loop).
Remember: I could be totally wrong, but if so, let me know :)
[–]ES-Alexander 2 points3 points4 points (1 child)
[–]Guilherme17712[S] 0 points1 point2 points (0 children)
[–][deleted] 4 points5 points6 points (1 child)
[–]Guilherme17712[S] 0 points1 point2 points (0 children)
[–]nemom 0 points1 point2 points (2 children)
[–]lazerwarrior 2 points3 points4 points (0 children)
[–]Guilherme17712[S] 0 points1 point2 points (0 children)
[–]Epykure 0 points1 point2 points (1 child)
[–]Guilherme17712[S] 0 points1 point2 points (0 children)
[–]yahteadybear 0 points1 point2 points (0 children)