Author p-ganssle
Recipients FFY00, p-ganssle, pablogsal, steven.daprano, theacodes, tlalexander, veky
Date 2021-07-12.13:55:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
If we want to confine the behavior to just the repl, we could possibly have the repl set an environment variable or something of that nature for interactive sessions, so that `__repr__` of `exit` can tell the difference between being invoked in a REPL and not — though I suppose it could cause some pretty frustrating and confusing behavior if some library function is doing something like this behind the scenes:

def get_all_reprs():
    return {
      v: repr(obj) for v, obj in globals()

You could invoke some function and suddenly your shell quits for no apparent reason. And if it only happens when triggered in a REPL, you'd be doubly confused because you can't reproduce it with a script.

I do think the "type exit() to exit" is a papercut. The ideal way to fix it would be in the REPL layer by special-casing `exit`, but I realize that that may introduce unnecessary complexity that isn't worth it for this one thing.

> Second, if absolutely necessary we could ask the user to confirm that they want to exit.

A thought occurs: we could simply re-word the message to make it seem like we're asking for confirmation:

>>> exit
Do you really want to exit? Press Ctrl+Z to confirm, or type exit() to exit without confirmation.

Then it won't seem as much like we know what you meant to do but aren't doing it, despite the fact that the behavior is exactly the same 😅.
Date User Action Args
2021-07-12 13:55:13p-gansslesetrecipients: + p-ganssle, steven.daprano, veky, pablogsal, FFY00, theacodes, tlalexander
2021-07-12 13:55:12p-gansslesetmessageid: <>
2021-07-12 13:55:12p-gansslelinkissue44603 messages
2021-07-12 13:55:12p-gansslecreate