This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: IDLE: Better document close and exit.
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: epaine, lukasz.langa, miss-islington, taleinat, terry.reedy
Priority: normal Keywords: patch

Created on 2021-09-26 20:52 by terry.reedy, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 28577 merged terry.reedy, 2021-09-27 05:27
PR 28600 merged miss-islington, 2021-09-28 12:06
PR 28601 merged miss-islington, 2021-09-28 12:06
PR 30936 merged terry.reedy, 2022-01-27 01:00
PR 30944 merged miss-islington, 2022-01-27 03:16
PR 30945 merged miss-islington, 2022-01-27 03:16
Messages (12)
msg402678 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-09-26 20:52
On Windows:
>>> exit
'Use exit() or Ctrl-Z plus Return to exit'
>>> quit
'Use quit() or Ctrl-Z plus Return to exit'
>>> exit.eof
'Ctrl-Z plus Return'

On *nix, 'Ctrl-Z plus Return' is 'Ctrl-D (i.e, EOF)'
IDLE uses the latter even on Windows, and Ctrl-Z does not work.

Both exit and quit are instances of _sitebuiltins.Quitter
https://github.com/python/cpython/blob/e14d5ae5447ae28fc4828a9cee8e9007f9c30700/Lib/_sitebuiltins.py#L13-L26
class Quitter(object):
    def __init__(self, name, eof):
        self.name = name
        self.eof = eof
    def __repr__(self):
        return 'Use %s() or %s to exit' % (self.name, self.eof)
    def __call__ [not relevant here]

We just need to replace current exit/quit.eof as indicated above on startup.
msg402689 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-09-27 04:49
Tal, Paine: should be use exactly the raw REPL message or something that might be clearer to beginners, like 'Ctrl-D (end-of-file)'?
msg402693 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2021-09-27 06:24
How about "Control-D (end-of-file, a.k.a. EOF)" or even just "Control-D"?
msg402697 - (view) Author: E. Paine (epaine) * Date: 2021-09-27 09:00
> How about "Control-D (end-of-file, a.k.a. EOF)"

I doubt beginners care that it's EOF.

> or even just "Control-D"

I'd be a lot more inclined towards this.

> IDLE uses the latter [Ctrl-D] even on Windows, and Ctrl-Z does not work.

Is it worth considering changing this behaviour? IMO Ctrl-D is better for consistency between platforms, but wanted to throw the idea out there for discussion.
msg402768 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-28 12:06
New changeset e649e0658ff2af87b07d994c05ae048e16e31aae by Terry Jan Reedy in branch 'main':
bpo-45296: Fix exit/quit message on Windows (GH-28577)
https://github.com/python/cpython/commit/e649e0658ff2af87b07d994c05ae048e16e31aae
msg402773 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-28 12:35
New changeset 813fbba4cab4556e55d6044c05725a26ec20b648 by Miss Islington (bot) in branch '3.9':
bpo-45296: Fix exit/quit message on Windows (GH-28577) (GH-28601)
https://github.com/python/cpython/commit/813fbba4cab4556e55d6044c05725a26ec20b648
msg402774 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-28 12:35
New changeset acd46feff3c06d3f1d00ab850e530c519445a737 by Miss Islington (bot) in branch '3.10':
bpo-45296: Fix exit/quit message on Windows (GH-28577) (GH-28600)
https://github.com/python/cpython/commit/acd46feff3c06d3f1d00ab850e530c519445a737
msg402775 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-28 12:38
The wording chosen by Terry, i.e. "Ctrl-D (end-of-file)", is pretty clear. Merged and fixed. Thanks!
msg402820 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-09-29 05:35
Unfortunately, I have discovered, the new wording is better but only correct for IDLE when Shell is the only window.

On the file menu, I want to:
A. Change 'Close' to 'Close Window', so it is clear that 'Close'/Alt-F4 only close the window and not IDLE.
B. Also change 'Exit' to 'Exit IDLE' or maybe 'Quit IDLE', so it is clearer that this and Ctrl-Q close all windows and exit IDLE.  Ctrl-Q is the default binding for 'close-all-windows', which users can configure.

Also, add a little in the doc entry for these choices.  Or maybe open a separate issue to add the option name for all menu entry hotkeys that can be rebound.  I don't know how many that is.

For a single window app, like the REPL, when not running in Command Prompt or the equivalent, closing the window and exiting the application are the same thing.  The same is true when Shell is the only IDLE window.  Closing Shell exits IDLE.  After submitting the PR, I discovered that exit() and quit() only close Shell but do not exit IDLE if there are other windows.  So the message should really be something like the following:

To close Shell, enter 'exit()', 'quit()', or 'Alt-F4'.
To exit IDLE, hit 'Ctrl-Q', hotkey for 'File >= Exit IDLE'.

This requires replacing the __repr__ method.  Someone who rebinds either hotkey option, which I expect is rare, will have to remember that they did so if that happen to enter either 'exit' or 'quit' without parens.
--

The question of IDLE on Windows and <^Z Return> was discussed some years ago on an issue a vaguely remember but could not find.  It was decided to either not add it or maybe to remove it, and key cross-platform ^D for closing Shell (and only Shell as it does nothing in Editor).  I don't want to change that decision.
msg411829 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2022-01-27 03:16
New changeset fcde0bc10ddd836b62d0a8e893d80b8c55e0ba3f by Terry Jan Reedy in branch 'main':
bpo-45296: Clarify close, quit, and exit in IDLE (GH-30936)
https://github.com/python/cpython/commit/fcde0bc10ddd836b62d0a8e893d80b8c55e0ba3f
msg411832 - (view) Author: miss-islington (miss-islington) Date: 2022-01-27 03:41
New changeset bc7d96ee332c8a575a453ec81367f2ad499f57d3 by Miss Islington (bot) in branch '3.9':
bpo-45296: Clarify close, quit, and exit in IDLE (GH-30936)
https://github.com/python/cpython/commit/bc7d96ee332c8a575a453ec81367f2ad499f57d3
msg411834 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2022-01-27 03:55
New changeset 5acaad0b3033fde6f21de6ac73681cd6cf64b1f7 by Miss Islington (bot) in branch '3.10':
bpo-45296: Clarify close, quit, and exit in IDLE (GH-30936) (GH-30944)
https://github.com/python/cpython/commit/5acaad0b3033fde6f21de6ac73681cd6cf64b1f7
History
Date User Action Args
2022-04-11 14:59:50adminsetgithub: 89459
2022-01-27 03:56:18terry.reedysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2022-01-27 03:55:29terry.reedysetmessages: + msg411834
2022-01-27 03:41:17miss-islingtonsetmessages: + msg411832
2022-01-27 03:16:46miss-islingtonsetpull_requests: + pull_request29124
2022-01-27 03:16:41miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request29123
2022-01-27 03:16:39terry.reedysetmessages: + msg411829
2022-01-27 01:00:34terry.reedysetstage: patch review
pull_requests: + pull_request29115
2021-09-29 05:36:00terry.reedysetstatus: closed -> open

title: IDLE: Change Ctrl-Z note in exit/quit repr on Windows -> IDLE: Better document close and exit.
nosy: - miss-islington

messages: + msg402820
resolution: fixed -> (no value)
stage: resolved -> (no value)
2021-09-28 12:38:37lukasz.langasetstatus: open -> closed
resolution: fixed
messages: + msg402775

stage: patch review -> resolved
2021-09-28 12:35:27lukasz.langasetmessages: + msg402774
2021-09-28 12:35:08lukasz.langasetmessages: + msg402773
2021-09-28 12:06:10miss-islingtonsetpull_requests: + pull_request26977
2021-09-28 12:06:05miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request26976
2021-09-28 12:06:05lukasz.langasetnosy: + lukasz.langa
messages: + msg402768
2021-09-27 09:00:30epainesetmessages: + msg402697
2021-09-27 06:24:16taleinatsetmessages: + msg402693
2021-09-27 05:27:08terry.reedysetkeywords: + patch
stage: patch review
pull_requests: + pull_request26960
2021-09-27 04:49:24terry.reedysetnosy: + taleinat, epaine
messages: + msg402689
2021-09-27 04:45:25terry.reedysetassignee: terry.reedy
type: behavior
components: + IDLE
versions: + Python 3.9, Python 3.10, Python 3.11
2021-09-26 20:52:27terry.reedycreate