Author steven.daprano
Recipients FFY00, pablogsal, steven.daprano, theacodes, tlalexander, veky
Date 2021-07-12.12:16:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I strongly oppose this change. Merely printing an object should not have a side-effect of this magnitude. Standard Python behaviour is that an object's repr should return a useful string, not exit the interpreter.

This is a backwards-incompatible change: right now, it is perfectly safe to print the builtins namespace in the interactive interpreter:


Doing so gives you are rather large dict, but it is safe and useful. If we make exit actually exit the interpreter instead of print a human readable string, printing the builtins will no longer be safe. It will surprisingly exit in the middle of printing the dict.

`exit` is not magic syntax, it is an actual object. It exists in the builtins namespace. We can put it in lists, we can introspect it and treat it like any other object.

And most importantly, we can print it and get a useful string.

It is not user-friendly to introduce magical special cases. To call a function, Python always requires parentheses. In the builtins and stdlib there are no special cases of functions that magically perform some task just by trying to view it in the interactive interpreter.

(Of course third party code can do anything. If somebody wants the `+` operator to exit the interpreter, or len(obj) to erase their hard drive, Python will allow it.)

Making a handful of objects -- help, exit (quit), license -- behave differently to everything else is not user friendly. Consistency is more important than convenience, especially when it comes to something like exit where the side-effect is to exit the interpreter.

What of copyright and credits? I think their design is a mistake, especially copyright. With 11 lines of output, the copyright object seriously uglifies printing the builtins. But at least it doesn't exit the interpreter.
Date User Action Args
2021-07-12 12:16:45steven.dapranosetrecipients: + steven.daprano, veky, pablogsal, FFY00, theacodes, tlalexander
2021-07-12 12:16:45steven.dapranosetmessageid: <>
2021-07-12 12:16:45steven.dapranolinkissue44603 messages
2021-07-12 12:16:45steven.dapranocreate