Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fde9242

Browse files
committed
Don’t use “arg” for “argument”
1 parent 19f9b71 commit fde9242

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

Doc/library/argparse.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Parsing arguments
109109

110110
:class:`ArgumentParser` parses arguments through the
111111
:meth:`~ArgumentParser.parse_args` method. This will inspect the command line,
112-
convert each arg to the appropriate type and then invoke the appropriate action.
112+
convert each argument to the appropriate type and then invoke the appropriate action.
113113
In most cases, this means a simple :class:`Namespace` object will be built up from
114114
attributes parsed out of the command line::
115115

@@ -771,11 +771,11 @@ values are:
771771
Note that ``nargs=1`` produces a list of one item. This is different from
772772
the default, in which the item is produced by itself.
773773

774-
* ``'?'``. One arg will be consumed from the command line if possible, and
775-
produced as a single item. If no command-line arg is present, the value from
774+
* ``'?'``. One argument will be consumed from the command line if possible, and
775+
produced as a single item. If no command-line argument is present, the value from
776776
default_ will be produced. Note that for optional arguments, there is an
777777
additional case - the option string is present but not followed by a
778-
command-line arg. In this case the value from const_ will be produced. Some
778+
command-line argument. In this case the value from const_ will be produced. Some
779779
examples to illustrate this::
780780

781781
>>> parser = argparse.ArgumentParser()
@@ -817,7 +817,7 @@ values are:
817817

818818
* ``'+'``. Just like ``'*'``, all command-line args present are gathered into a
819819
list. Additionally, an error message will be generated if there wasn't at
820-
least one command-line arg present. For example::
820+
least one command-line argument present. For example::
821821

822822
>>> parser = argparse.ArgumentParser(prog='PROG')
823823
>>> parser.add_argument('foo', nargs='+')
@@ -828,7 +828,7 @@ values are:
828828
PROG: error: too few arguments
829829

830830
If the ``nargs`` keyword argument is not provided, the number of arguments consumed
831-
is determined by the action_. Generally this means a single command-line arg
831+
is determined by the action_. Generally this means a single command-line argument
832832
will be consumed and a single item (not a list) will be produced.
833833

834834

@@ -847,7 +847,7 @@ the various :class:`ArgumentParser` actions. The two most common uses of it are
847847
(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional
848848
argument that can be followed by zero or one command-line arguments.
849849
When parsing the command line, if the option string is encountered with no
850-
command-line arg following it, the value of ``const`` will be assumed instead.
850+
command-line argument following it, the value of ``const`` will be assumed instead.
851851
See the nargs_ description for examples.
852852

853853
The ``const`` keyword argument defaults to ``None``.
@@ -859,7 +859,7 @@ default
859859
All optional arguments and some positional arguments may be omitted at the
860860
command line. The ``default`` keyword argument of
861861
:meth:`~ArgumentParser.add_argument`, whose value defaults to ``None``,
862-
specifies what value should be used if the command-line arg is not present.
862+
specifies what value should be used if the command-line argument is not present.
863863
For optional arguments, the ``default`` value is used when the option string
864864
was not present at the command line::
865865

@@ -871,7 +871,7 @@ was not present at the command line::
871871
Namespace(foo=42)
872872

873873
For positional arguments with nargs_ ``='?'`` or ``'*'``, the ``default`` value
874-
is used when no command-line arg was present::
874+
is used when no command-line argument was present::
875875

876876
>>> parser = argparse.ArgumentParser()
877877
>>> parser.add_argument('foo', nargs='?', default=42)
@@ -957,8 +957,8 @@ choices
957957
Some command-line arguments should be selected from a restricted set of values.
958958
These can be handled by passing a container object as the ``choices`` keyword
959959
argument to :meth:`~ArgumentParser.add_argument`. When the command line is
960-
parsed, arg values will be checked, and an error message will be displayed if
961-
the arg was not one of the acceptable values::
960+
parsed, argument values will be checked, and an error message will be displayed if
961+
the argument was not one of the acceptable values::
962962

963963
>>> parser = argparse.ArgumentParser(prog='PROG')
964964
>>> parser.add_argument('foo', choices='abc')
@@ -1061,7 +1061,7 @@ value as the "name" of each object. By default, for positional argument
10611061
actions, the dest_ value is used directly, and for optional argument actions,
10621062
the dest_ value is uppercased. So, a single positional argument with
10631063
``dest='bar'`` will that argument will be referred to as ``bar``. A single
1064-
optional argument ``--foo`` that should be followed by a single command-line arg
1064+
optional argument ``--foo`` that should be followed by a single command-line argument
10651065
will be referred to as ``FOO``. An example::
10661066

10671067
>>> parser = argparse.ArgumentParser()
@@ -1168,7 +1168,7 @@ The parse_args() method
11681168
created and how they are assigned. See the documentation for
11691169
:meth:`add_argument` for details.
11701170

1171-
By default, the arg strings are taken from :data:`sys.argv`, and a new empty
1171+
By default, the argument strings are taken from :data:`sys.argv`, and a new empty
11721172
:class:`Namespace` object is created for the attributes.
11731173

11741174

@@ -1244,7 +1244,7 @@ Arguments containing ``"-"``
12441244

12451245
The :meth:`~ArgumentParser.parse_args` method attempts to give errors whenever
12461246
the user has clearly made a mistake, but some situations are inherently
1247-
ambiguous. For example, the command-line arg ``'-1'`` could either be an
1247+
ambiguous. For example, the command-line argument ``'-1'`` could either be an
12481248
attempt to specify an option or an attempt to provide a positional argument.
12491249
The :meth:`~ArgumentParser.parse_args` method is cautious here: positional
12501250
arguments may only begin with ``'-'`` if they look like negative numbers and
@@ -1398,7 +1398,7 @@ Sub-commands
13981398
>>> parser_b = subparsers.add_parser('b', help='b help')
13991399
>>> parser_b.add_argument('--baz', choices='XYZ', help='baz help')
14001400
>>>
1401-
>>> # parse some arg lists
1401+
>>> # parse some argument lists
14021402
>>> parser.parse_args(['a', '12'])
14031403
Namespace(bar=12, foo=False)
14041404
>>> parser.parse_args(['--foo', 'b', '--baz', 'Z'])

0 commit comments

Comments
 (0)