Title: IDLE - Restart Shell & Run Module
Type: behavior Stage:
Components: IDLE Versions: Python 2.6, Python 2.5
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: kbk Nosy List: kbk, taleinat
Priority: normal Keywords: patch

Created on 2008-02-08 12:34 by taleinat, last changed 2008-02-11 23:19 by taleinat. This issue is now closed.

File name Uploaded Description Edit
IDLE_restart_shell_and_run_module.080208.patch taleinat, 2008-02-08 12:34 initial patch
Messages (5)
msg62195 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2008-02-08 12:34
When IDLE is run with a subprocess, add a 'Restart Shell & Run Module'
item to the 'Run' menu in editor windows. Also add Alt-F5 as a hotkey
for this item.

This is what the 'Run Module' (F5) item used to do (when there was a
subprocess). As of this patch 'Run Module' will not restart the shell
under any circumstances.

The advantages of this are that the user has more control (can run a
module in the shell either with or without restarting). It also avoids
surprising users which wouldn't expect 'Run Module' to restart the shell.

Based on changes proposed by Doug on idle-dev:
msg62268 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2008-02-11 02:27
I don't want to complicate the IDLE interface and confuse the users 
with an additional decision (or a chording keypress for the normal 
state) for this very special case (messing up a connection to a 
robot).  One of the main features of using the IDLE subprocess is a 
clean restart and reload of all code being run.

An alternate approach would be to have a config-main item which if 
set (and not settable in the Options Dialog!) would skip the Shell 
restart when running code with F5.  The user could then hit Ctrl-F6
when he did want a restart.
msg62281 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2008-02-11 11:07
I agree that the interface should be kept as simple as possible, but
this is a meaningful and important addition, which will help clarify to
the users how to work with the subprocess. The point of this change is
avoid surprising the user, while also making the interface more
straightforward and consistent.

The major usage issues that this patch addresses, as I see them, are:

1. New users are surprised and aggravated when they first use 'Run
Module', because they weren't expecting the shell to be restarted,
causing them to lose a lot of work done before the restart. This also
happens to experienced users sometimes (accidents happen) and can be
very frustrating. I don't think the 'normal state' should be to restart
the shell, rather this should always be explicitly requested by the user.

2. When working with a subprocess, there is no (simple) way to just run
the module in the shell without restarting it.

3. Inconsistency in the functionality of 'Run Module' depending on
whether you have a subprocess.

The problem with the configuration option approach is that if you
configure 'Run Module' to not restart, then restarting requires:
switching to the Shell window, restarting, switching back to the editor
window, and running the module: 4 actions instead of one.
msg62293 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2008-02-11 22:13
I disagree.  It's a major feature of the revised IDLE that code is 
in a fresh environment every time.  New users will only be 
once, if at all.  They will learn to put the creation of the 
etc. that they want to retain into the top level module they are 
running.  Getting into a discussion of whether to start fresh or 
and why, adds more confusion than it eliminates, particularly for 
beginners. Also, should this be implemented, if someone were to 
accidentally make the wrong choice they are going to be *really* 

I would accept a patch for a hidden switch to enable this behavior 
for the unique application in question.  Maybe even better, a patch 
for a normally disabled extension to add the functionality and menu 

Running w/o the subprocess is for 'experts'.  It was rather 
surprising we were able to continue to do it.
msg62299 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2008-02-11 23:19
First of all, installing Python on Windows creates a 'Edit with IDLE'
context-menu item whenever you right-click a .py file, which opens IDLE
without a subprocess. The reason for this is that there is still a
problem regarding having several instances of IDLE, each with a
subprocess, open in parallel on Windows. The result is that many users
on Windows are often running IDLE without a subprocess; we can't treat
it as an 'expert' mode.

IMHO if you really feel strongly about this, then the Windows issue must
be resolved, and the 'Edit with IDLE' context-menu item should run IDLE
with a subprocess.

I understand your point that having the shell be restarted every time
helps teach good programming practices. But IDLE is used not only as a
learning environment; it's also a great Python shell for other purposes,
such as testing & debugging or scientific uses. I agree that these are
more advanced uses, so perhaps restarting the shell could be the
default, and the option to not have it restarted available when needed.

Thinking about it, I like the idea of an extension which is disabled by
default. I'll think about it some more, and then perhaps implement it.
Just a thought: It would be important to mention such an extension in a
prominent place in the documentation.
Date User Action Args
2008-02-11 23:19:15taleinatsetmessages: + msg62299
2008-02-11 22:13:23kbksetmessages: + msg62293
severity: normal -> minor
2008-02-11 11:07:20taleinatsetmessages: + msg62281
2008-02-11 02:27:37kbksetstatus: open -> closed
resolution: rejected
messages: + msg62268
2008-02-08 18:57:12christian.heimessetpriority: normal
assignee: kbk
2008-02-08 12:41:42facundobatistasetkeywords: + patch
2008-02-08 12:34:29taleinatcreate