summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHai Shi <shihai1992@gmail.com>2022-05-06 03:32:35 (GMT)
committerGitHub <noreply@github.com>2022-05-06 03:32:35 (GMT)
commit301351c6a227249770fdf498054e6bbce1c3ee3c (patch)
tree4465e7248048d475bfcc1d250d2bc5fa6d8ff020
parent299692afd8b8520383e6badeb907b285fc7c0909 (diff)
downloadcpython-301351c6a227249770fdf498054e6bbce1c3ee3c.zip
cpython-301351c6a227249770fdf498054e6bbce1c3ee3c.tar.gz
cpython-301351c6a227249770fdf498054e6bbce1c3ee3c.tar.bz2
update argparse's doc of append action. (#92344)
-rw-r--r--Doc/library/argparse.rst6
1 files changed, 4 insertions, 2 deletions
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
index 5d269cc..b5a2b79 100644
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -846,8 +846,10 @@ how the command-line arguments should be handled. The supplied actions are:
Namespace(foo=True, bar=False, baz=True)
* ``'append'`` - This stores a list, and appends each argument value to the
- list. This is useful to allow an option to be specified multiple times.
- Example usage::
+ 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')