[issue35533] argparse standard error usage for exit / error

2019-02-07 Thread paul j3


paul j3  added the comment:

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:

- developers may want to issue their own `parser.error('...')` call, during 
post-parsing value checking, or issue their own `parser.exit()` call in a 
custom 'Action' class (much like what '_HelpAction' does).

- developers might want to modify one or both of these in a ArgumentParser 
subclass.  The unittesting code in argparse does this to capture and redirect 
errors.

In both cases I expect the developer will want to read the code as well as the 
documentation.  The fact that `exit()` uses stderr is quite obvious from the 
code.  

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)".

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35533] argparse standard error usage for exit / error

2019-02-03 Thread paul j3


Change by paul j3 :


--
nosy: +paul.j3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35533] argparse standard error usage for exit / error

2019-01-19 Thread Vinay Badhan


Vinay Badhan  added the comment:

Add documentation for exit() function

--
keywords: +patch
nosy: +vinayb21
pull_requests: +11377
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35533] argparse standard error usage for exit / error

2018-12-22 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +bethard
versions: +Python 3.8

__
Python tracker 

__
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35533] argparse standard error usage for exit / error

2018-12-19 Thread Philip Rowlands


New submission from Philip Rowlands :

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:
https://github.com/python/cpython/blob/3.7/Lib/argparse.py#L2482

--
assignee: docs@python
components: Documentation
messages: 332128
nosy: docs@python, philiprowlands
priority: normal
severity: normal
status: open
title: argparse standard error usage for exit / error
type: enhancement
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com