sys.exit(1) vs raise SystemExit vs raise

Ben Finney ben+python at benfinney.id.au
Tue Apr 12 19:20:21 EDT 2016


"Martin A. Brown" <martin at linux-ip.net> writes:

> The only change from what Ben suggests is that, once I found os.EX_OK,
> I just kept on using it, instead of difining my own EXIT_SUCCESS in
> every program.

Ah, thank you! I was unaware of the exit-status constants in ‘os’::

    The following exit codes are defined and can be used with _exit(),
    although they are not required. These are typically used for system
    programs written in Python […]

    <URL:https://docs.python.org/3/library/os.html#os._exit>

That defines a whole lot of exit status values with mnemonic names. I
will try to make use of those instead of re-inventing them.

-- 
 \           “Let others praise ancient times; I am glad I was born in |
  `\                                      these.” —Ovid (43 BCE–18 CE) |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list