[New-bugs-announce] [issue14504] Suggestion to improve argparse's help messages for "store_const"

Amnon Harel report at bugs.python.org
Thu Apr 5 10:34:12 CEST 2012

New submission from Amnon Harel <amnon.harel at cern.ch>:

argparse's help messages for variables that use "store_const" can probably be improved:
- propagate the default to all the options
- mark the default option as such explicitly
- group the keywords that have the same destination together (?)
- place the default option first (?)

For example, wouldn't the attached .py be better served with a help message that looks like:
optional arguments:
  -h, --help         show this help message and exit
  -w, --wrench       use a wrench (default)
  -H, --hammer       use a hammer (default: wrench)
  -s, --screwdriver  use a screwdriver (default: wrench)
  -T, --tnt          just blow the whole thing up (default: wrench)
  --foo FOO          foo bar (default: None)


components: Library (Lib)
files: demo.py
messages: 157554
nosy: Amnon.Harel
priority: normal
severity: normal
status: open
title: Suggestion to improve argparse's help messages for "store_const"
type: enhancement
versions: Python 2.7
Added file: http://bugs.python.org/file25129/demo.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list