[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

Alexander Belopolsky report at bugs.python.org
Mon Apr 27 21:55:47 CEST 2015


Alexander Belopolsky added the comment:

> if you use them, your code won't work with long time
> supported CPython versions like 3.4 for the next decade or so.

This would be a generic argument against any new feature.  I don't think it is very compelling in this case.  For people who develop on a latest version. these constants will pop up in sys.<tab> autocompletion and they will likely use them.  If they need to support pre-3.5 versions,

try:
    from sys import exit, EXIT_FAILURE
except ImportError:
    from sys import exit
    EXIT_FAILURE = 1

is not a hard work-around.

You would say, why not just use EXIT_FAILURE = 1 to begin with?  To avoid Bob using EXIT_FAILURE = -1, Alice using EX_FAIL = 1 and Karl
giving up and using exit(1) in perpetuity.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24053>
_______________________________________


More information about the Python-bugs-list mailing list