[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

Vedran Čačić report at bugs.python.org
Fri Jul 16 23:49:43 EDT 2021


Vedran Čačić <vedgar at gmail.com> added the comment:

> In the other hand, special-casing 'quit\n' and 'exit\n' could be seen as analogous to special-casing '^Z\n'

Terry, there is a big difference between special-casing 'exit\n' and special-casing '^Z\n': 'exit' is a perfectly valid identifier (and people use it regularly), ^Z is not. Especially if 'exit\n' exited unconditionally, I think many people would be very frustrated and surprised when trying to inspect the variable called 'exit'.

I'd have no objection if something like '!exit' was special-cased, but then there is not much difference between adding a bang before and adding the parentheses after. Alternatively, exit can be proclaimed a keyword, but I really think this is overkill.

And please don't think this process that you're starting now will stop at these two words. Much more beginners, according to my experience, try to type `pip install something` inside Python REPL. If we do this, it will be a powerful precedent, and almost surely we will have the "magic mess" later.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44603>
_______________________________________


More information about the Python-bugs-list mailing list