What is Python's default exit code?

Viewed 11177

Assuming your script doesn't exit due to any kind of failure (exception, syntax error) and the script doesn't exit due to sys.exit() or os._exit(), how does Python figure out what exit code to exit with?

It seems to be 0, which makes sense since it indicates no-error on *nix systems. However, will that always be the case that it exits with 0 (except for the cases above)? Surprisingly after quite a bit of online searching, I couldn't find anything which explicitly said that it would exit with 0 unless otherwise specified.

4 Answers
Related