Python etc / Interactive shell: exit

Interactive shell: exit

>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit

Ever wonder why is this message displayed once you try to exit interactive Python with just exit or quit? The solution is quite unexpected yet graceful. It's not a special case for interactive shell, it just shows a representation of every result evaluated, and this line is just a representation of exit function.

Strictly speaking, you should not use exit in your everyday projects since it was created specifically for interactive shell. Use sys.exit() instead.