Skip to content

Commit 25e3574

Browse files
authored
Minor improvements to grammar and markup. (GH-91762)
1 parent d608a01 commit 25e3574

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Doc/library/argparse.rst

+12-12
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ around an instance of :class:`argparse.ArgumentParser`. It is a container for
3434
argument specifications and has options that apply the parser as whole::
3535

3636
parser = argparse.ArgumentParser(
37-
prog = 'ProgramName',
38-
description = 'What the program does',
39-
epilog = 'Text at the bottom of help')
37+
prog = 'ProgramName',
38+
description = 'What the program does',
39+
epilog = 'Text at the bottom of help')
4040

41-
The :func:`ArgumentParser.add_argument` function attaches individual argument
41+
The :meth:`ArgumentParser.add_argument` method attaches individual argument
4242
specifications to the parser. It supports positional arguments, options that
4343
accept values, and on/off flags::
4444

4545
parser.add_argument('filename') # positional argument
46-
parser.add_argument('-c', '--count') # option that takes value
46+
parser.add_argument('-c', '--count') # option that takes a value
4747
parser.add_argument('-v', '--verbose',
4848
action='store_true') # on/off flag
4949

50-
The :func:`ArgumentParser.parse_args` function runs the parser and puts
50+
The :meth:`ArgumentParser.parse_args` method runs the parser and places
5151
the extracted data in a :class:`argparse.Namespace` object::
5252

5353
args = parser.parse_args()
@@ -61,15 +61,15 @@ Quick Links for add_argument()
6161
Name Description Values
6262
====================== =========================================================== ==========================================================================================================================
6363
action_ Specify how an argument should be handled ``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, ``'append_const'``, ``'count'``, ``'help'``, ``'version'``
64-
choices_ Limit values to specific set of choices ``['foo', 'bar']``, ``range(1, 10)``, or an object that supports ``in`` operator
64+
choices_ Limit values to a specific set of choices ``['foo', 'bar']``, ``range(1, 10)``, or :class:`~collections.abc.Container` instance
6565
const_ Store a constant value
66-
default_ Default value used when an argument is not provided
67-
dest_ Specify the attribute name in result namespace
66+
default_ Default value used when an argument is not provided Defaults to *None*
67+
dest_ Specify the attribute name used in the result namespace
6868
help_ Help message for an argument
6969
metavar_ Alternate display name for the argument as shown in help
70-
nargs_ Number of times the argument can be used ``N`` (:class:`int`), ``'?'``, ``'*'``, ``'+'``, ``argparse.REMAINDER``
71-
required_ Indicate whether an optional argument is required or not ``True``, ``False``
72-
type_ Automatically convert an argument to the given type :class:`int`, :class:`float`, ``argparse.FileType('w')``, or any callable function
70+
nargs_ Number of times the argument can be used :class:`int`, ``'?'``, ``'*'``, ``'+'``, or ``argparse.REMAINDER``
71+
required_ Indicate whether an argument is required or optional ``True`` or ``False``
72+
type_ Automatically convert an argument to the given type :class:`int`, :class:`float`, ``argparse.FileType('w')``, or callable function
7373
====================== =========================================================== ==========================================================================================================================
7474

7575

0 commit comments

Comments
 (0)