Message402644
Running the REPL with -S is unusual, so having to use sys.exit() or `raise SystemExit` in that case shouldn't be an issue.
A user who wants custom behavior for `exit` could override sys.displayhook() in the PYTHONSTARTUP file. For example:
import sys
import builtins
def displayhook(obj, prev_displayhook=sys.displayhook):
exit = getattr(builtins, 'exit', None)
if obj is exit and callable(exit):
exit()
else:
prev_displayhook(obj)
sys.displayhook = displayhook
> just note that you can always do Ctrl-D.
For the Windows console, Ctrl-D is not usually supported. It's supported when pyreadline is installed. Otherwise one has to type Ctrl-Z and enter. In IDLE it's Ctrl-D even in Windows, in which case the `exit` repr is wrong, as determined by setquit() in Lib/site.py. |
|
Date |
User |
Action |
Args |
2021-09-25 20:00:38 | eryksun | set | recipients:
+ eryksun, terry.reedy, gregory.p.smith, eric.araujo, steven.daprano, veky, p-ganssle, pablogsal, asmeurer, FFY00, theacodes, jack__d, tlalexander, DiddiLeija |
2021-09-25 20:00:38 | eryksun | set | messageid: <1632600038.02.0.0728474333168.issue44603@roundup.psfhosted.org> |
2021-09-25 20:00:38 | eryksun | link | issue44603 messages |
2021-09-25 20:00:37 | eryksun | create | |
|