4 ms·
>I understand that <function exit> might be confusing for newcomers, and exiting might be too destructive. But denying you the normal REPL behavior and denying
by eurleif 3y ago
>I understand that <function exit> might be confusing for newcomers, and exiting might be too destructive. But denying you the normal REPL behavior and denying you the ability to exit is just insulting.
Sentence 1 provides a clear justification for the behavior. Then sentence 2 declares, by bare assertion, that it's "insulting".
I find sentence 1 more persuasive than sentence 2.
- wharvle 3y ago1 may be more persuasive but it’s 2 that makes me wish someone a very bad day every time that message prints.
- zarzavat 3y agoThe correct behavior is to print: Are you sure you want to exit? [y] and then you press enter again to exit.
- eurleif 3y agoThe correct behavior from `repr()` isn't to do anything, including reading from stdin. That would break documentation generators, along with anything else that expects to be able to call `repr()` without side effects.
- zarzavat 3y agoNobody said anything about repr()? It's the REPL's job to handle this case and provide a good UX.
- eurleif 3y ago`exit` is simply a function. The text it displays at the REPL now is simply the result of calling `repr()` on that function. Adding a special case would make the REPL more complicated, and would make it inconsistent. Technically it wouldn't even be an REPL anymore, since it wouldn't be doing the "P" part for certain objects. And the special case would break tools that rely on the REPL behaving consistently.