Why does not IDLE automatically stop running the program?

6

I think it's more out of curiosity. Unlike other IDEs, IDLE keeps the program "open" even after the end of its execution, while in other IDE's I need to put something like 'input ()' at the end so the program will not be terminated until I enter some value.

Would anyone know how to explain this behavior to me?

    
asked by anonymous 16.08.2014 / 15:13

3 answers

3

This is due to the fact that IDLE uses the Python console itself to run its programs, line by line. Therefore, when your program is finished, IDLE does not exit Python automatically, since IDLE works with Python's interactive mode, that is, it executes all commands sent by a text input (terminal or stdin) and goes processing them as they are typed.

    
16.08.2014 / 17:16
1

Actually, IDLE does finish running programs.

The problem is that it has two basic components: the Python console (known as "interactive mode") and the editor. Programs loaded in the editor can be run normally with the "Run > Run module" command or by the "F5" shortcut.

The outputs will be displayed on the console, but the program itself will run and shut down like anywhere else, except in case of errors.

In the console, as already mentioned, you enter a sequence of commands, one after the other, that are executed at each entry.

    
17.08.2014 / 13:22
0

The advantage of this is that the program's global variables and functions remain accessible. Taking a look at them may be helpful, especially if the program has finished but did not work as expected.

    
10.09.2014 / 00:16