0

Is there any reason why python interpretor will automatically restart when a recursive function is called? I'm programming a quick sort algorithm, and trying to sort a an large array of digits (order 10^4), but when I try to sort the full array python is restarting, i.e. giving me:

============================== RESTART ==============================

and all the values/functions stored in memory disappears. N.B. the code works fine for smaller values (<10^4). Is there fail safe been triggered due to the large amount of recursion?

added: python & IDLE info:

enter image description here

cubearth
  • 1,153
  • 4
  • 15
  • 30

1 Answers1

1

The most likely you got this message in IDLE. In IDLE, the "===RESTART===" is simply IDLE flushing its memory of the previous code.

UPDATE

If you entered IDLE by right-clicking on a program and choosing "Edit with IDLE," then these ====RESTART==== messages do not appear; IDLE is running in a slightly different mode. But everything still works.

Read here more about IDLE

Maksym Polshcha
  • 18,030
  • 8
  • 52
  • 77
  • Thanks, but I want to know why it is doing it and how I can stop it so it can sort my array for me. – cubearth Jul 02 '12 at 05:04
  • 1
    It should not prevent you from "sorting your array". Please show us the code you are using to attempt to do so. – Karl Knechtel Jul 02 '12 at 05:16
  • Idle normally (unless started with -n) runs user code in a user subprocess. The RESTART line means that the subprocess has been restarted. Regardless of how one starts Idle (without -n) this occurs either when one selects Shell -> Restart Shell Cntl+F6 or Run -> Run Module F5. It also occurs if the user process crashes from a program bug. If one starts Idle from a command line (`python -m idlelib` or `... idlelib.idle` in 2.x, an error message might start there. – Terry Jan Reedy Mar 23 '15 at 16:20