4 ms·
The correct behavior from `repr()` isn't to do anything, including reading from stdin. That would break documentation generators, along with anything else that
by eurleif 3y ago
The 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.