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.

classification
Title: argparse Incorrect Handling of Store Actions
Type: behavior Stage: resolved
Components: Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Flux, xiang.zhang
Priority: normal Keywords:

Created on 2016-10-29 17:21 by Flux, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_argparse.py Flux, 2016-10-29 17:21 Example of Error
Messages (2)
msg279686 - (view) Author: Chris (Flux) Date: 2016-10-29 17:21
argparse does not handle Store actions correctly when "nargs = 1" is provided. The documentation indicates the value should be assigned to the dest, but instead a list with the value as the only item is assigned to dest.
msg279687 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-10-29 17:29
This is the expected behaviour. The doc explicitly says "Note that nargs=1 produces a list of one item. This is different from the default, in which the item is produced by itself". Read https://docs.python.org/3/library/argparse.html#nargs.
History
Date User Action Args
2022-04-11 14:58:38adminsetgithub: 72744
2016-10-29 17:29:24xiang.zhangsetstage: resolved
2016-10-29 17:29:05xiang.zhangsetstatus: open -> closed

nosy: + xiang.zhang
messages: + msg279687

resolution: not a bug
2016-10-29 17:21:51Fluxcreate