In a Python program which runs a for
loop over a fixed range
many times, e.g.,
while some_clause:
for i in range(0, 1000)
pass
...
does it make sense to cache range
:
r = range(0, 1000)
while some_clause:
for i in r
pass
...
or will it not add much benefit?