This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年04月05日 08:34 by Amnon.Harel, last changed 2022年04月11日 14:57 by admin.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| demo.py | Amnon.Harel, 2012年04月05日 08:34 | |||
| Messages (2) | |||
|---|---|---|---|
| msg157554 - (view) | Author: Amnon Harel (Amnon.Harel) | Date: 2012年04月05日 08:34 | |
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) ? |
|||
| msg166064 - (view) | Author: Steven Bethard (bethard) * (Python committer) | Date: 2012年07月21日 20:38 | |
Special casing the formatting of 'store_const' makes me nervous because formatting is already complicated and it doesn't know anything about action types. But feel free to propose a patch! In the meantime: - propagate the default to all the options You can, of course, do this manually, by specifying default in each of them. And if you use formatter_class=ArgumentDefaultsHelpFormatter, you'll get the defaults in the usage message. - group the keywords that have the same destination together (?) - place the default option first (?) You can achieve both of these by just adding the options in the order that you want them displayed. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:28 | admin | set | github: 58709 |
| 2012年07月21日 20:38:59 | bethard | set | messages: + msg166064 |
| 2012年04月05日 13:00:44 | r.david.murray | set | nosy:
+ bethard versions: + Python 3.3, - Python 2.7 |
| 2012年04月05日 08:34:11 | Amnon.Harel | create | |