-
-
Notifications
You must be signed in to change notification settings - Fork 33k
Closed
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir
Description
Documentation
The documentation for argparse's append
action when a default value is provided is unclear
Currently the docs state:
'append' - This stores a list, and appends each argument value to the list. It is useful to allow an option to be specified multiple times. If the default value is non-empty, the default elements will be present in the parsed value for the option, with any values from the command line appended after those default values. Example usage:
parser = argparse.ArgumentParser()
parser.add_argument('--foo', action='append')
parser.parse_args('--foo 1 --foo 2'.split())
Namespace(foo=['1', '2'])
However, this documentation does not specify that the default needs to be a list, and cannot be a single value. While this may be obvious in hindsight, a short example would entirely remove this source of confusion.
Linked PRs
Metadata
Metadata
Assignees
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir
Projects
Status
No status
Status
Todo