This question is not about how to use sys.exit
(or raising SystemExit
directly), but rather about why you would want to use it.
- If a program terminates successfully, I see no point in explicitly exiting at the end.
- If a program terminates with an error, just raise that error. Why would you need to explicitly exit the program or why would you need an exit code?