| That's because there's no magic in the REPL. You're typing nothing but regular Python code. 'exit' is an object. Expressions typed at the REPL are stringified. Thus, when you type 'exit', it gets stringified, and thus you get that message. 'exit' is also a callable, so if you type 'exit()', the REPL will exit. The same goes for 'help', 'copyright', 'credits', and 'license': they're just objects that get stringified. Having the REPL work the way you want would mean building magic into it, and magic avoidance is part of the language's culture, so that's not going to happen. Having it print that message is a compromise between keeping things friendly and building magic into the REPL, if you consider printing the result of expressions automatically to be magic. The Python REPL isn't being a dick, it's being parsimonious and predictable in its behaviour. |
This is what Ruby developers mean when they say they optimize for developer happiness over bowing to the will of the computer.
/uses Python regularly and enjoys it.