1

Is there a way to use numpy.nditer to perform an operation N times? I attempted to use this here but I wasn't able to utilise ['external_loop'] parameter and hence wasn't able to reduce function run time.

N = numpy.arange(iterations)

for _ in numpy.nditer(N, ['external_loop']):
    do_something()

I understand that the following variations may be used to repeat a process n times without dependency on the index variable as here, but I was curious to see if nditer could be utilised:

for _ in range(N):
    do_something()

for _ in itertools.repeat(None, N):
    do_something()
Josmoor98
  • 1,489
  • 6
  • 21

0 Answers0