[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2022-02-19 Thread Mark Dickinson
Change by Mark Dickinson : -- nosy: -mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2022-02-18 Thread Stefan Behnel
Stefan Behnel added the comment: > Any reasons the PR still not merged? There was dissent about whether these constants should be added or not. It doesn't help to merge a PR that is not expected to provide a benefit. -- ___ Python tracker

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2022-02-18 Thread Golubev Alexander
Golubev Alexander added the comment: Any reasons the PR still not merged? -- nosy: +Fat-Zer ___ Python tracker ___ ___ Python-bugs-

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2019-07-14 Thread Arnold Dumas
Change by Arnold Dumas : -- pull_requests: +14566 pull_request: https://github.com/python/cpython/pull/14773 ___ Python tracker ___

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2018-12-25 Thread Emmanuel Arias
Emmanuel Arias added the comment: Hi Elliot! > It seems like a no-brainer to add these, they reduce magic number use and > improve the accessibility of Python to people coming from C. I would love to > add these if everyone is OK with it. Sound great. But IMO I think that this can be solved

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2018-12-12 Thread Terry J. Reedy
Change by Terry J. Reedy : -- nosy: -terry.reedy ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2018-12-12 Thread Elliot Edmunds
Elliot Edmunds added the comment: I have personally come across situations where I am calling a Python script from a C program and would like to check the exit codes of the script, and have had to write sys.exit(1) and sys.exit(0) in Python, and compared them to EXIT_SUCCESS/EXIT_FAILURE in

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-11-27 Thread Robert Collins
Robert Collins added the comment: @Serhiy, EXIT_FAILURE is used in Python's C code itself (just once admittedly, and then we use 0 sometimes for success and sometimes for errors, and then 1 for errors... aiee.) FWIW to the extent that folk want to write posix code in Python, I'm all for helpi

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-07-21 Thread Martin Panter
Martin Panter added the comment: FWIW I have wondered in the past why these constants were missing. I would be more likely to use them when checking an exit status than when setting one. I typically do “raise SystemExit()” or “raise SystemExit('Error message')”, which implicitly sets the statu

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-07-21 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: -ethan.furman ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-05-12 Thread Martin Panter
Changes by Martin Panter : -- nosy: +vadmium ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Alexander Belopolsky
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

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > will confuse inexperienced users when they unexpectedly encounter with > sys.exit(sys.EXIT_FAILURE) instead of sys.exit(1). Are you serious? I've seen senior programmers who thought that status < 0 means failure and status >= 0 means success. Why wo

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Stefan Behnel
Stefan Behnel added the comment: Actually, my guess is also that these constants will not be used. Not because they are not helpful, but because they'd only be available in Python 3.5+. Meaning that if you use them, your code won't work with long time supported CPython versions like 3.4 for th

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > And even GNU tools usually use multiple error codes for different kinds of > errors. And how often do they not give them symbolic names? -- ___ Python tracker ___

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: How often you see EXIT_SUCCESS and EXIT_FAILURE in C code besides GNU tools that should support VMS? And even GNU tools usually use multiple error codes for different kinds of errors. I think that these constants are rather unusual for C programmers. I'm on

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: >> I want people to standardize on status=1 for a generic failure code. > Why that? Multiple error codes can be used by the same program, depending on > the kind of error. Antoine, please read what I write carefully before disagreeing. I want "to stand

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Stefan Behnel
Stefan Behnel added the comment: why not spell them "sys.exit.FAILURE" and "sys.exit.SUCCESS" ? -- nosy: +scoder ___ Python tracker ___ __

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Berker Peksag
Berker Peksag added the comment: > 1. I find exit(EXIT_FAILURE) much clearer than exit(1). import sys exit(sys.EXIT_FAILURE) or import sys sys.exit(sys.EXIT_FAILURE) don't look too clear to me. On the other hand, these constants may helpful to people who came from C world.

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I want people to standardize on status=1 for a generic failure code. Why that? Multiple error codes can be used by the same program, depending on the kind of error. > I want discourage people from using computed integer results as exit status. Ok, that's th

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > the convention should be between your program and the other program(s) you > are trying communicate with. This may be true in general, but Python stdlib sets the convention in its subprocess.check_call and subprocess.check_output methods. These method

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Ethan Furman
Ethan Furman added the comment: An entire PyPI module for two constants? Change of heart, I'm okay with them going in sys, but only +0 on adding them. This SO answer* has an interesting point to make about the nature of return codes and what their values should be; tl;dr - the convention shoul

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > This can be implemented as separate module on PyPI. Sure! Make them even less discoverable! Let me try to state my motivations for adding these constants: 1. I find exit(EXIT_FAILURE) much clearer than exit(1). 2. I want people to standardize on stat

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This can be implemented as separate module on PyPI. No need to add these aliases for 0 and 1 to the stdlib. -- ___ Python tracker ___ ___

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Stefan> I've seen academic code written by well-known researchers Stefan> that used 1 for a successful exit. Thank you! What I've seen more than once was exit(True) to indicate success where True is not necessarily a literal, but something like len(resul

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Stefan Krah
Stefan Krah added the comment: I'm +0 on adding these. The only reason is that I've seen academic code written by well-known researchers that used 1 for a successful exit. :) I'm not sure about the os module. These are C99 and not OS specific. -- ___

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Antoine Pitrou
Antoine Pitrou added the comment: Well it would be clearer if not for the widely established knowledge (amongst most or all programming languages) that zero means success and non-zero means failure. So in this case I find it personally useless. -- _

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Antoine> Since I don't really get the usability argument of adding those constants .. If I am alone in finding exit(EXIT_FAILURE) clearer than exit(1), I should certainly drop my proposal. -- ___ Python track

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Ethan> all the exit codes should be in one place. Do you realize that os.EX_* codes are not available on Windows? Having platform-independent EXIT_* codes next to posix-only EX_* codes will send the wrong message about their availability. -- _

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Antoine Pitrou
Antoine Pitrou added the comment: Well, my favourite answer would be use sys.exit(0) and sys.exit(1), respectively (or raise SystemExit without or with an error message), as everyone is already doing right now. Since I don't really get the usability argument of adding those constants, it's har

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > Then precisely, those new codes should go in the os module as well. What is your logic? Having os.EX_ codes in os does not help as far as sys.exit() is concerned: no-one is using them and they are not available on all platforms. If we add EXIT_FAILUR

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Ethan Furman
Ethan Furman added the comment: I agree with Antoine -- all the exit codes should be in one place. -- ___ Python tracker ___ ___ Pytho

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Antoine Pitrou
Antoine Pitrou added the comment: > We already have over a dozen BSDish exit codes in os that are hardly > ever used. Then precisely, those new codes should go in the os module as well. -- ___ Python tracker _

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > Those should be in the os module, not in sys. I disagree. The whole point of this proposal is to have platform-independent status codes available next to the sys.exit() function. We already have over a dozen BSDish exit codes in os that are hardly eve

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-26 Thread Antoine Pitrou
Antoine Pitrou added the comment: Those should be in the os module, not in sys. The os module is for interfaces to the operating system, while the sys module is for Python-specific stuff. As for the point of adding them, I don't find them useful, but I won't oppose it either :-) -- no

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I would say, they are there to support *humans*. I am not aware of any human language where "success" is spelled 0. (1 is a failing mark in some schools - so there is a precedent for that. :-) -- ___ Python

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Aren't EXIT_SUCCESS and EXIT_FAILURE needed only for support VMS? -- ___ Python tracker ___ ___ Py

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-24 Thread Ethan Furman
Ethan Furman added the comment: Sounds good, I have no objections. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubsc

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > Where are EXIT_FAILURE and EXIT_SUCCESS defined? In C stdlib: $ grep EXIT_ /usr/include/stdlib.h #define EXIT_FAILURE1 #define EXIT_SUCCESS0 > we should probably call them EX_FAILURE and EX_SUCESS to match what's already > there. No. EX_ macr

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-24 Thread Ethan Furman
Ethan Furman added the comment: Where are EXIT_FAILURE and EXIT_SUCCESS defined? And we should probably call them EX_FAILURE and EX_SUCESS to match what's already there. -- ___ Python tracker

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-24 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- nosy: +skrah ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-24 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- nosy: +ethan.furman, mark.dickinson, serhiy.storchaka, terry.reedy ___ Python tracker ___ ___ Pyt

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I am attaching a patch implementing these constants. If this is well-received, I will add documentation. -- assignee: -> belopolsky keywords: +easy, patch stage: -> patch review versions: +Python 3.5 Added file: http://bugs.python.org/file39197

[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys

2015-04-24 Thread Alexander Belopolsky
New submission from Alexander Belopolsky: Python defines some BSDish exit codes in the os module: EX_CANTCREAT = 73 EX_CONFIG = 78 EX_DATAERR = 65 EX_IOERR = 74 EX_NOHOST = 68 EX_NOINPUT = 66 EX_NOPERM = 77 EX_NOUSER = 67 EX_OK = 0 EX_OSERR = 71 EX_OSF