Always use sys.exit()
to exit in production code. Built-in's like quit
or exit
can be omitted in some envs.
os._exit(n) Exit the process with status n, without calling cleanup handlers, flushing stdio buffers, etc.
Note: The standard way to exit is sys.exit(n). _exit() should normally only be used in the child process after a fork().