summaryrefslogtreecommitdiffstats
path: root/Doc/library/argparse.rst
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-10-28 11:41:26 (GMT)
committerGitHub <noreply@github.com>2018-10-28 11:41:26 (GMT)
commit913876d824d969f8c7431e8a9d4610a9a11a786e (patch)
treef98ec4ccbb5f2db38d2ea62e1583745db2957c0b /Doc/library/argparse.rst
parent95f68b10d5c9852ef4dcf5b9f2ae15fdf74e8f1c (diff)
downloadcpython-913876d824d969f8c7431e8a9d4610a9a11a786e.zip
cpython-913876d824d969f8c7431e8a9d4610a9a11a786e.tar.gz
cpython-913876d824d969f8c7431e8a9d4610a9a11a786e.tar.bz2
bpo-35054: Add yet more index entries for symbols. (GH-10121)
Diffstat (limited to 'Doc/library/argparse.rst')
-rw-r--r--Doc/library/argparse.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
index 1973afc..cef197f 100644
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -844,6 +844,8 @@ values are:
Note that ``nargs=1`` produces a list of one item. This is different from
the default, in which the item is produced by itself.
+.. index:: single: ? (question mark); in argparse module
+
* ``'?'``. One argument will be consumed from the command line if possible, and
produced as a single item. If no command-line argument is present, the value from
default_ will be produced. Note that for optional arguments, there is an
@@ -876,6 +878,8 @@ values are:
Namespace(infile=<_io.TextIOWrapper name='<stdin>' encoding='UTF-8'>,
outfile=<_io.TextIOWrapper name='<stdout>' encoding='UTF-8'>)
+.. index:: single: * (asterisk); in argparse module
+
* ``'*'``. All command-line arguments present are gathered into a list. Note that
it generally doesn't make much sense to have more than one positional argument
with ``nargs='*'``, but multiple optional arguments with ``nargs='*'`` is
@@ -888,6 +892,8 @@ values are:
>>> parser.parse_args('a b --foo x y --bar 1 2'.split())
Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])
+.. index:: single: + (plus); in argparse module
+
* ``'+'``. Just like ``'*'``, all command-line args present are gathered into a
list. Additionally, an error message will be generated if there wasn't at
least one command-line argument present. For example::