◐ Shell
clean mode source ↗

Message 296498 - Python tracker

I rewrote title to slightly generalize, and add and document here on the tracker additional variations that have been requested or that I have thought of.

1. Autosave <untitled> to somewhere, like .idlerc/untitled.py

2. Run without saving, by stuffing code lines into the line cache, as done with lines entered into Shell.  Use <unsaved> rather than <PyShell> as pseudo file name.

Either 1 or 2 has been requested multiple times.  It is part of the GPolo megapatch of #10079 that adds or changes about 10 features at once.  I do not know at the moment if it implemented 1 or 2.  msg149930 says "This functionality is scattered across several files."  

Some other ideas:

3. Run without restarting.  This *seems* easy.  Requests:
https://stackoverflow.com/questions/43814027/how-to-prevent-python-idle-from-restarting-when-running-new-script
https://stackoverflow.com/questions/41926321/run-a-module-in-idle-python-3-4-without-restart

4. Run selection. This seems more useful without restart. I would make it default if there *is* a selection.  (Alt-F5?, context menu?

5. Run as input.  Print prompt and statement; run as if entered; add to history.  Requires parsing into statements, which is not trivial.  Compile with mode=statement has 3 returns: error, partial statement so far okay, success.  Anything after 1st statement is ignored. This blocks pasting multiple lines.  But provides alternative for entering multiline statments.

6. Run with 'tracing -t'. Print line# and statement.  Similar to autostep in debugger.

7. Run with debugger, without having to turn it on in the Shell that may not exist.

8. Run with command line arguments #5680.

9. Run with PYTHONSTARTUP or IDLESTARTUP file.

We cannot have menu options for each run option, let alone combinations of options.  I am thinking of adding one 'Custom Run' or 'Run w/ Options' or ??? menu entry and a dialog box with the F5 settings the initial defaults.  The setting for a particular file should be persistent, and can be across IDLE sessions, as with debug breakpoints.

I intend to open a separate issue for
10. Run in a console, detached, with output to the console.
This should probably have a separate 'Run in Console' menu entry and options box.