[issue28742] argparse.ArgumentDefaultsHelpFormatter sometimes provides inaccurate documentation of defaults, so they should be overrideable
Peter Eckersley
report at bugs.python.org
Fri Nov 18 19:17:09 EST 2016
New submission from Peter Eckersley:
When argparse lists the default values for cli flags and arguments, it shows argparse's view of the internal Pythonic default, not the default behaviour of the program as a whole. This can be wrong in many cases, as documented at https://bugs.python.org/issue27153 and https://github.com/certbot/certbot/issues/3734.
To mitigate this, we should allow the caller to set arbitrary strings that argparse will display to the user as the "default" in the CLI help.
I wrote a first patch to do this via a new "help_default" argument that can be added to argparse actions:
https://gist.github.com/pde/daec08cadc21bca0d62852020887ee13
The patch was written against argparse.py from Python2.7, but seems to apply and run okay against the Python 3.x version.
----------
messages: 281183
nosy: pde
priority: normal
severity: normal
status: open
title: argparse.ArgumentDefaultsHelpFormatter sometimes provides inaccurate documentation of defaults, so they should be overrideable
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28742>
_______________________________________
More information about the Python-bugs-list
mailing list