New submission from Stargirl Flowers <me@thea.codes>:
Presently, when using REPL if a user types simply "exit", they are greeted with 
a message instructing them to do it "correctly":

>>> exit
Use exit() or Ctrl-Z plus Return to exit

It comes across as a little surprising that (1) the program knows what I meant 
and (2) the program told me it wouldn't do it unless I request it in a very 
specific way. This isn't very user-friendly behavior.

Further surprising is the inconsistent behavior of the other built-ins 
described on interpreter start-up. "copyright" and "credits" work fine without 
being invoked as a function, whereas "help" and "license" rebuff the user. 

I know there are compelling technical reasons for the current behavior, 
however, this behavior is a bit off-putting for newcomers. Knowing the 
technical reasons behind this behavior made me *more* frustrated than less 
frustrated.

Python is a lovely language and I think we should do what we can to be 
friendlier to users. I propose a few changes to fix this specific issue:

(1) Include "exit" in the interpreter startup message, making it: Type "help", 
"copyright", "credits" or "license" for more information, and type "exit" to 
quit Python.

(2) Make the interactive interpreter exit when the user types simply "exit" or 
"quit.

To address some possible edge cases an objections:

- if (2) proves too controversial, we should at least do (1) with the slight 
modification of "exit" to "exit()".
- if there is a concern about accidentally exiting the interpreter, there are 
several strategies we can use. First, we can only activate this behavior if, 
and only if, Python is being used as an interactive interpreter. From what I 
can tell, main() is already distinguishing this case. Second, if absolutely 
necessary we could ask the user to confirm that they want to exit. For example:

>>> exit
Are you sure you want to exit Python? (yes/no): 

For what it's worth, I am willing to do this work, however, I might need a 
little guidance to find the right bits.

----------
components: Demos and Tools
messages: 397273
nosy: theacodes
priority: normal
severity: normal
status: open
title: REPL: exit when the user types exit instead of asking them to explicitly 
type exit()

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44603>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to