Hacker News new | ask | show | jobs
by saulpw 903 days ago
How about making `exit.__repr__` raise a CleanExit exception that gets caught in the outer REPL and then exits?
1 comments

I'm fairly sure that having any object's `__repr__` throw an exception and exit would lead to even more confusion. Especially if it exits cleanly.

The object shouldn't be in scope anywhere other than the REPL, but that doesn't mean that something, somewhere, isn't stringifying everything because $REASONS and changing the behaviour won't cause an obscure "crash" somewhere unexpected and hard to debug.