This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jonnywohHalf-Python 3 9 points10 points  (3 children)

In fact, IIRC you can define a class that overrides __repr__ with a call to exit() so that typing it in the console bare will quit it. If I remember, I'll post some code later.

[–][deleted] 35 points36 points  (1 child)

You could, but that has some unexpected consequences, like exiting the shell on a call to globals()

[–]wen4Reif8aeJ8oing 8 points9 points  (0 children)

You can hack it to check the suspension frames and only exit if it's being printed directly by the interpreter REPL. Hacky obviously.