[New-bugs-announce] [issue33389] argparse redundant help string

Stefan Seefeld report at bugs.python.org
Sun Apr 29 15:38:21 EDT 2018

New submission from Stefan Seefeld <stefan at seefeld.name>:

I'm using Python's `argparse` module to define optional arguments.
I'm calling the `argparse.add_argument` method to add both short and long arguments, but I notice that the generated help message lists some information twice. For example:
argparse.add_argument('-s', '--service',...)
will generate

-s SERVICE, --service SERVICE
and when I add a `choices` argument, even the choices list is repeated. I think it would be more useful to suppress the repetition to produce output such as
-s|--service SERVICE ...
instead with both the meta var as well as choices etc. printed only once.

components: Library (Lib)
messages: 315917
nosy: stefan
priority: normal
severity: normal
status: open
title: argparse redundant help string
type: enhancement

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list