-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
argparse standard error usage for exit / error #79714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Because error() mentions standard error and exit() does not, I assumed exit() did not use stderr, but it does. Please mention standard error in the description of exit(). Relevant code at: |
Add documentation for exit() function |
The proposed PR does not address this issue. It just adds comments to the method code, which aren't really needed. The method is short and obvious. We don't need, at this time, to get into questions of whether comments in argparse.py conform to one of the PEPs. All this issue needs is a change to the documentation. Changing: ArgumentParser.exit(status=0, message=None) This method terminates the program, exiting with the specified status and, if given, it prints a message before that. to: ArgumentParser.exit(status=0, message=None) This method terminates the program, exiting with the specified status and, if given, it prints a message to **standard error** before that. While I'm not opposed to this change, I don't think it is important. The documentation makes these two methods public, which I believe serves two purposes:
In both cases I expect the developer will want to read the code as well as the documentation. The fact that It's worth keeping in mind that the documentation never replicates the code. For example, in this case the documentation says error(), "terminates the program with a status code of 2.", when what it really does is "terminates with a call to exit(status=2)". |
…xit() (pythonGH-123932) (cherry picked from commit 5f5c0b9) Co-authored-by: Savannah Ostrowski <[email protected]>
…arser.exit() (pythonGH-123932) (cherry picked from commit 5f5c0b9) Co-authored-by: Savannah Ostrowski <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
The text was updated successfully, but these errors were encountered: