1

Currently I am trying to do 3000 iterations of some function using a for-loop (using Spyder). The function however, which I imported from a package, contains a bug. Because of the bug, the function gets slower with every iteration. When I restart the IPython console, the function is fast again but it again gets slower with every iteration.

So, this is what I want to do:

  1. Run (for example) 100 iterations
  2. Restart console
  3. Run the next 100 iterations
  4. Restart console

And so forth, until I've done 3000 iterations.

I know this sounds like a cumbersome process but I don't know how to do it differently since I don't have the skills (and time) to debug the complicated function I am using.

Thanks in advance

LVDW
  • 11
  • 4
  • 1
    `xargs` might be useful, you can run it with `-n 100` to pass a max of 100 arguments to a program – Sam Mason Apr 09 '19 at 14:40
  • This seems similar to [this recent question](https://stackoverflow.com/questions/55554746/how-to-restart-kernel-in-python-through-code-in-spyder-to-avoid-repetitively-and) which had a suggested answer [here](https://stackoverflow.com/questions/54943710/code-to-clear-console-and-variables-in-spyder/54947631#54947631) - does that solution work for you? – nekomatic Apr 15 '19 at 12:19

0 Answers0