Commit 913876d8 authored by Serhiy Storchaka's avatar Serhiy Storchaka Committed by GitHub

bpo-35054: Add yet more index entries for symbols. (GH-10121)

parent 95f68b10
...@@ -844,6 +844,8 @@ values are: ...@@ -844,6 +844,8 @@ values are:
Note that ``nargs=1`` produces a list of one item. This is different from Note that ``nargs=1`` produces a list of one item. This is different from
the default, in which the item is produced by itself. 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 * ``'?'``. 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 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 default_ will be produced. Note that for optional arguments, there is an
...@@ -876,6 +878,8 @@ values are: ...@@ -876,6 +878,8 @@ values are:
Namespace(infile=<_io.TextIOWrapper name='<stdin>' encoding='UTF-8'>, Namespace(infile=<_io.TextIOWrapper name='<stdin>' encoding='UTF-8'>,
outfile=<_io.TextIOWrapper name='<stdout>' 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 * ``'*'``. 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 it generally doesn't make much sense to have more than one positional argument
with ``nargs='*'``, but multiple optional arguments with ``nargs='*'`` is with ``nargs='*'``, but multiple optional arguments with ``nargs='*'`` is
...@@ -888,6 +892,8 @@ values are: ...@@ -888,6 +892,8 @@ values are:
>>> parser.parse_args('a b --foo x y --bar 1 2'.split()) >>> parser.parse_args('a b --foo x y --bar 1 2'.split())
Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y']) 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 * ``'+'``. Just like ``'*'``, all command-line args present are gathered into a
list. Additionally, an error message will be generated if there wasn't at list. Additionally, an error message will be generated if there wasn't at
least one command-line argument present. For example:: least one command-line argument present. For example::
......
...@@ -41,6 +41,9 @@ Node classes ...@@ -41,6 +41,9 @@ Node classes
with alternatives (aka "sums"), the left-hand side class is abstract: only with alternatives (aka "sums"), the left-hand side class is abstract: only
instances of specific constructor nodes are ever created. instances of specific constructor nodes are ever created.
.. index:: single: ? (question mark); in AST grammar
.. index:: single: * (asterisk); in AST grammar
.. attribute:: _fields .. attribute:: _fields
Each concrete class has an attribute :attr:`_fields` which gives the names Each concrete class has an attribute :attr:`_fields` which gives the names
......
...@@ -61,6 +61,10 @@ A :class:`Cmd` instance has the following methods: ...@@ -61,6 +61,10 @@ A :class:`Cmd` instance has the following methods:
An end-of-file on input is passed back as the string ``'EOF'``. An end-of-file on input is passed back as the string ``'EOF'``.
.. index::
single: ? (question mark); in a command interpreter
single: ! (exclamation); in a command interpreter
An interpreter instance will recognize a command name ``foo`` if and only if it An interpreter instance will recognize a command name ``foo`` if and only if it
has a method :meth:`do_foo`. As a special case, a line beginning with the has a method :meth:`do_foo`. As a special case, a line beginning with the
character ``'?'`` is dispatched to the method :meth:`do_help`. As another character ``'?'`` is dispatched to the method :meth:`do_help`. As another
......
...@@ -312,6 +312,14 @@ defined and implemented by all standard Python codecs: ...@@ -312,6 +312,14 @@ defined and implemented by all standard Python codecs:
The following error handlers are only applicable to The following error handlers are only applicable to
:term:`text encodings <text encoding>`: :term:`text encodings <text encoding>`:
.. index::
single: ? (question mark); replacement character
single: \ (backslash); escape sequence
single: \x; escape sequence
single: \u; escape sequence
single: \U; escape sequence
single: \N; escape sequence
+-------------------------+-----------------------------------------------+ +-------------------------+-----------------------------------------------+
| Value | Meaning | | Value | Meaning |
+=========================+===============================================+ +=========================+===============================================+
......
...@@ -295,7 +295,7 @@ On top of the core functionality, :class:`ConfigParser` supports ...@@ -295,7 +295,7 @@ On top of the core functionality, :class:`ConfigParser` supports
interpolation. This means values can be preprocessed before returning them interpolation. This means values can be preprocessed before returning them
from ``get()`` calls. from ``get()`` calls.
.. index:: single: %; interpolation in configuration files .. index:: single: % (percent); interpolation in configuration files
.. class:: BasicInterpolation() .. class:: BasicInterpolation()
...@@ -325,7 +325,7 @@ from ``get()`` calls. ...@@ -325,7 +325,7 @@ from ``get()`` calls.
``%(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(my_dir)s/Pictures`` as the value of ``my_pictures`` and
``%(home_dir)s/lumberjack`` as the value of ``my_dir``. ``%(home_dir)s/lumberjack`` as the value of ``my_dir``.
.. index:: single: $; interpolation in configuration files .. index:: single: $ (dollar); interpolation in configuration files
.. class:: ExtendedInterpolation() .. class:: ExtendedInterpolation()
......
...@@ -207,6 +207,10 @@ The following function takes either a single-character string or integer value; ...@@ -207,6 +207,10 @@ The following function takes either a single-character string or integer value;
it returns a string. it returns a string.
.. index::
single: ^ (caret); in curses module
single: ! (exclamation); in curses module
.. function:: unctrl(c) .. function:: unctrl(c)
Return a string representation of the ASCII character *c*. If *c* is printable, Return a string representation of the ASCII character *c*. If *c* is printable,
......
...@@ -2000,7 +2000,7 @@ Class attributes: ...@@ -2000,7 +2000,7 @@ Class attributes:
.. index:: .. index::
single: %; datetime format single: % (percent); datetime format
.. _strftime-strptime-behavior: .. _strftime-strptime-behavior:
......
...@@ -485,7 +485,7 @@ Some details you should read once, but won't need to remember: ...@@ -485,7 +485,7 @@ Some details you should read once, but won't need to remember:
to test a :exc:`SyntaxError` that omits the traceback header, you will need to to test a :exc:`SyntaxError` that omits the traceback header, you will need to
manually add the traceback header line to your test example. manually add the traceback header line to your test example.
.. index:: single: ^; caret .. index:: single: ^ (caret); marker
* For some :exc:`SyntaxError`\ s, Python displays the character position of the * For some :exc:`SyntaxError`\ s, Python displays the character position of the
syntax error, using a ``^`` marker:: syntax error, using a ``^`` marker::
...@@ -695,9 +695,9 @@ useful unless you intend to extend :mod:`doctest` internals via subclassing: ...@@ -695,9 +695,9 @@ useful unless you intend to extend :mod:`doctest` internals via subclassing:
.. index:: .. index::
single: #; in doctests single: # (hash); in doctests
single: +; in doctests single: + (plus); in doctests
single: -; in doctests single: - (minus); in doctests
.. _doctest-directives: .. _doctest-directives:
Directives Directives
......
...@@ -16,6 +16,13 @@ This module provides support for Unix shell-style wildcards, which are *not* the ...@@ -16,6 +16,13 @@ This module provides support for Unix shell-style wildcards, which are *not* the
same as regular expressions (which are documented in the :mod:`re` module). The same as regular expressions (which are documented in the :mod:`re` module). The
special characters used in shell-style wildcards are: special characters used in shell-style wildcards are:
.. index::
single: * (asterisk); in glob-style wildcards
single: ? (question mark); in glob-style wildcards
single: [] (square brackets); in glob-style wildcards
single: ! (exclamation); in glob-style wildcards
single: - (minus); in glob-style wildcards
+------------+------------------------------------+ +------------+------------------------------------+
| Pattern | Meaning | | Pattern | Meaning |
+============+====================================+ +============+====================================+
......
...@@ -63,7 +63,7 @@ class-based API instead. ...@@ -63,7 +63,7 @@ class-based API instead.
*domain*, which is returned. *domain*, which is returned.
.. index:: single: _; gettext .. index:: single: _ (underscore); gettext
.. function:: gettext(message) .. function:: gettext(message)
Return the localized translation of *message*, based on the current global Return the localized translation of *message*, based on the current global
......
...@@ -10,6 +10,14 @@ ...@@ -10,6 +10,14 @@
-------------- --------------
.. index::
single: * (asterisk); in glob-style wildcards
single: ? (question mark); in glob-style wildcards
single: [] (square brackets); in glob-style wildcards
single: ! (exclamation); in glob-style wildcards
single: - (minus); in glob-style wildcards
single: . (dot); in glob-style wildcards
The :mod:`glob` module finds all the pathnames matching a specified pattern The :mod:`glob` module finds all the pathnames matching a specified pattern
according to the rules used by the Unix shell, although results are returned in according to the rules used by the Unix shell, although results are returned in
arbitrary order. No tilde expansion is done, but ``*``, ``?``, and character arbitrary order. No tilde expansion is done, but ``*``, ``?``, and character
...@@ -36,6 +44,9 @@ For example, ``'[?]'`` matches the character ``'?'``. ...@@ -36,6 +44,9 @@ For example, ``'[?]'`` matches the character ``'?'``.
:file:`../../Tools/\*/\*.gif`), and can contain shell-style wildcards. Broken :file:`../../Tools/\*/\*.gif`), and can contain shell-style wildcards. Broken
symlinks are included in the results (as in the shell). symlinks are included in the results (as in the shell).
.. index::
single: **; in glob-style wildcards
If *recursive* is true, the pattern "``**``" will match any files and zero or If *recursive* is true, the pattern "``**``" will match any files and zero or
more directories and subdirectories. If the pattern is followed by an more directories and subdirectories. If the pattern is followed by an
``os.sep``, only directories and subdirectories match. ``os.sep``, only directories and subdirectories match.
......
...@@ -160,7 +160,7 @@ the :mod:`glob` module.) ...@@ -160,7 +160,7 @@ the :mod:`glob` module.)
Accepts a :term:`path-like object`. Accepts a :term:`path-like object`.
.. index:: single: ~; home directory expansion .. index:: single: ~ (tilde); home directory expansion
.. function:: expanduser(path) .. function:: expanduser(path)
...@@ -186,8 +186,8 @@ the :mod:`glob` module.) ...@@ -186,8 +186,8 @@ the :mod:`glob` module.)
Accepts a :term:`path-like object`. Accepts a :term:`path-like object`.
.. index:: .. index::
single: $; environment variables expansion single: $ (dollar); environment variables expansion
single: %; environment variables expansion (Windows) single: % (percent); environment variables expansion (Windows)
.. function:: expandvars(path) .. function:: expandvars(path)
......
...@@ -4086,7 +4086,7 @@ are defined for all platforms. ...@@ -4086,7 +4086,7 @@ are defined for all platforms.
Higher-level operations on pathnames are defined in the :mod:`os.path` module. Higher-level operations on pathnames are defined in the :mod:`os.path` module.
.. index:: single: .; in pathnames .. index:: single: . (dot); in pathnames
.. data:: curdir .. data:: curdir
The constant string used by the operating system to refer to the current The constant string used by the operating system to refer to the current
...@@ -4102,8 +4102,8 @@ Higher-level operations on pathnames are defined in the :mod:`os.path` module. ...@@ -4102,8 +4102,8 @@ Higher-level operations on pathnames are defined in the :mod:`os.path` module.
:mod:`os.path`. :mod:`os.path`.
.. index:: single: /; in pathnames .. index:: single: / (slash); in pathnames
.. index:: single: \; in pathnames (Windows) .. index:: single: \ (backslash); in pathnames (Windows)
.. data:: sep .. data:: sep
The character used by the operating system to separate pathname components. The character used by the operating system to separate pathname components.
...@@ -4113,7 +4113,7 @@ Higher-level operations on pathnames are defined in the :mod:`os.path` module. ...@@ -4113,7 +4113,7 @@ Higher-level operations on pathnames are defined in the :mod:`os.path` module.
useful. Also available via :mod:`os.path`. useful. Also available via :mod:`os.path`.
.. index:: single: /; in pathnames .. index:: single: / (slash); in pathnames
.. data:: altsep .. data:: altsep
An alternative character used by the operating system to separate pathname An alternative character used by the operating system to separate pathname
...@@ -4122,14 +4122,15 @@ Higher-level operations on pathnames are defined in the :mod:`os.path` module. ...@@ -4122,14 +4122,15 @@ Higher-level operations on pathnames are defined in the :mod:`os.path` module.
:mod:`os.path`. :mod:`os.path`.
.. index:: single: .; in pathnames .. index:: single: . (dot); in pathnames
.. data:: extsep .. data:: extsep
The character which separates the base filename from the extension; for example, The character which separates the base filename from the extension; for example,
the ``'.'`` in :file:`os.py`. Also available via :mod:`os.path`. the ``'.'`` in :file:`os.py`. Also available via :mod:`os.path`.
.. index:: single: :; path separator (POSIX) .. index:: single: : (colon); path separator (POSIX)
single: ; (semicolon)
.. data:: pathsep .. data:: pathsep
The character conventionally used by the operating system to separate search The character conventionally used by the operating system to separate search
......
...@@ -93,20 +93,20 @@ the expression ``(?:a{6})*`` matches any multiple of six ``'a'`` characters. ...@@ -93,20 +93,20 @@ the expression ``(?:a{6})*`` matches any multiple of six ``'a'`` characters.
The special characters are: The special characters are:
.. index:: single: .; in regular expressions .. index:: single: . (dot); in regular expressions
``.`` ``.``
(Dot.) In the default mode, this matches any character except a newline. If (Dot.) In the default mode, this matches any character except a newline. If
the :const:`DOTALL` flag has been specified, this matches any character the :const:`DOTALL` flag has been specified, this matches any character
including a newline. including a newline.
.. index:: single: ^; in regular expressions .. index:: single: ^ (caret); in regular expressions
``^`` ``^``
(Caret.) Matches the start of the string, and in :const:`MULTILINE` mode also (Caret.) Matches the start of the string, and in :const:`MULTILINE` mode also
matches immediately after each newline. matches immediately after each newline.
.. index:: single: $; in regular expressions .. index:: single: $ (dollar); in regular expressions
``$`` ``$``
Matches the end of the string or just before the newline at the end of the Matches the end of the string or just before the newline at the end of the
...@@ -117,21 +117,21 @@ The special characters are: ...@@ -117,21 +117,21 @@ The special characters are:
a single ``$`` in ``'foo\n'`` will find two (empty) matches: one just before a single ``$`` in ``'foo\n'`` will find two (empty) matches: one just before
the newline, and one at the end of the string. the newline, and one at the end of the string.
.. index:: single: *; in regular expressions .. index:: single: * (asterisk); in regular expressions
``*`` ``*``
Causes the resulting RE to match 0 or more repetitions of the preceding RE, as Causes the resulting RE to match 0 or more repetitions of the preceding RE, as
many repetitions as are possible. ``ab*`` will match 'a', 'ab', or 'a' followed many repetitions as are possible. ``ab*`` will match 'a', 'ab', or 'a' followed
by any number of 'b's. by any number of 'b's.
.. index:: single: +; in regular expressions .. index:: single: + (plus); in regular expressions
``+`` ``+``
Causes the resulting RE to match 1 or more repetitions of the preceding RE. Causes the resulting RE to match 1 or more repetitions of the preceding RE.
``ab+`` will match 'a' followed by any non-zero number of 'b's; it will not ``ab+`` will match 'a' followed by any non-zero number of 'b's; it will not
match just 'a'. match just 'a'.
.. index:: single: ?; in regular expressions .. index:: single: ? (question mark); in regular expressions
``?`` ``?``
Causes the resulting RE to match 0 or 1 repetitions of the preceding RE. Causes the resulting RE to match 0 or 1 repetitions of the preceding RE.
...@@ -152,8 +152,7 @@ The special characters are: ...@@ -152,8 +152,7 @@ The special characters are:
only ``'<a>'``. only ``'<a>'``.
.. index:: .. index::
single: {; in regular expressions single: {} (curly brackets); in regular expressions
single: }; in regular expressions
``{m}`` ``{m}``
Specifies that exactly *m* copies of the previous RE should be matched; fewer Specifies that exactly *m* copies of the previous RE should be matched; fewer
...@@ -176,7 +175,7 @@ The special characters are: ...@@ -176,7 +175,7 @@ The special characters are:
6-character string ``'aaaaaa'``, ``a{3,5}`` will match 5 ``'a'`` characters, 6-character string ``'aaaaaa'``, ``a{3,5}`` will match 5 ``'a'`` characters,
while ``a{3,5}?`` will only match 3 characters. while ``a{3,5}?`` will only match 3 characters.
.. index:: single: \; in regular expressions .. index:: single: \ (backslash); in regular expressions
``\`` ``\``
Either escapes special characters (permitting you to match characters like Either escapes special characters (permitting you to match characters like
...@@ -192,8 +191,7 @@ The special characters are: ...@@ -192,8 +191,7 @@ The special characters are:
raw strings for all but the simplest expressions. raw strings for all but the simplest expressions.
.. index:: .. index::
single: [; in regular expressions single: [] (square brackets); in regular expressions
single: ]; in regular expressions
``[]`` ``[]``
Used to indicate a set of characters. In a set: Used to indicate a set of characters. In a set:
...@@ -201,7 +199,7 @@ The special characters are: ...@@ -201,7 +199,7 @@ The special characters are:
* Characters can be listed individually, e.g. ``[amk]`` will match ``'a'``, * Characters can be listed individually, e.g. ``[amk]`` will match ``'a'``,
``'m'``, or ``'k'``. ``'m'``, or ``'k'``.
.. index:: single: -; in regular expressions .. index:: single: - (minus); in regular expressions
* Ranges of characters can be indicated by giving two characters and separating * Ranges of characters can be indicated by giving two characters and separating
them by a ``'-'``, for example ``[a-z]`` will match any lowercase ASCII letter, them by a ``'-'``, for example ``[a-z]`` will match any lowercase ASCII letter,
...@@ -214,13 +212,13 @@ The special characters are: ...@@ -214,13 +212,13 @@ The special characters are:
``[(+*)]`` will match any of the literal characters ``'('``, ``'+'``, ``[(+*)]`` will match any of the literal characters ``'('``, ``'+'``,
``'*'``, or ``')'``. ``'*'``, or ``')'``.
.. index:: single: \; in regular expressions .. index:: single: \ (backslash); in regular expressions
* Character classes such as ``\w`` or ``\S`` (defined below) are also accepted * Character classes such as ``\w`` or ``\S`` (defined below) are also accepted
inside a set, although the characters they match depends on whether inside a set, although the characters they match depends on whether
:const:`ASCII` or :const:`LOCALE` mode is in force. :const:`ASCII` or :const:`LOCALE` mode is in force.
.. index:: single: ^; in regular expressions .. index:: single: ^ (caret); in regular expressions
* Characters that are not within a range can be matched by :dfn:`complementing` * Characters that are not within a range can be matched by :dfn:`complementing`
the set. If the first character of the set is ``'^'``, all the characters the set. If the first character of the set is ``'^'``, all the characters
...@@ -252,7 +250,7 @@ The special characters are: ...@@ -252,7 +250,7 @@ The special characters are:
:exc:`FutureWarning` is raised if a character set contains constructs :exc:`FutureWarning` is raised if a character set contains constructs
that will change semantically in the future. that will change semantically in the future.
.. index:: single: |; in regular expressions .. index:: single: | (vertical bar); in regular expressions
``|`` ``|``
``A|B``, where *A* and *B* can be arbitrary REs, creates a regular expression that ``A|B``, where *A* and *B* can be arbitrary REs, creates a regular expression that
...@@ -266,8 +264,7 @@ The special characters are: ...@@ -266,8 +264,7 @@ The special characters are:
character class, as in ``[|]``. character class, as in ``[|]``.
.. index:: .. index::
single: (; in regular expressions single: () (parentheses); in regular expressions
single: ); in regular expressions
``(...)`` ``(...)``
Matches whatever regular expression is inside the parentheses, and indicates the Matches whatever regular expression is inside the parentheses, and indicates the
...@@ -433,7 +430,7 @@ If the ordinary character is not an ASCII digit or an ASCII letter, then the ...@@ -433,7 +430,7 @@ If the ordinary character is not an ASCII digit or an ASCII letter, then the
resulting RE will match the second character. For example, ``\$`` matches the resulting RE will match the second character. For example, ``\$`` matches the
character ``'$'``. character ``'$'``.
.. index:: single: \; in regular expressions .. index:: single: \ (backslash); in regular expressions
``\number`` ``\number``
Matches the contents of the group of the same number. Groups are numbered Matches the contents of the group of the same number. Groups are numbered
...@@ -719,7 +716,7 @@ form. ...@@ -719,7 +716,7 @@ form.
.. data:: X .. data:: X
VERBOSE VERBOSE
.. index:: single: #; in regular expressions .. index:: single: # (hash); in regular expressions
This flag allows you to write regular expressions that look nicer and are This flag allows you to write regular expressions that look nicer and are
more readable by allowing you to visually separate logical sections of the more readable by allowing you to visually separate logical sections of the
......
...@@ -50,7 +50,7 @@ the key "include-system-site-packages" set to anything other than "false" ...@@ -50,7 +50,7 @@ the key "include-system-site-packages" set to anything other than "false"
searched for site-packages; otherwise they won't. searched for site-packages; otherwise they won't.
.. index:: .. index::
single: #; comment single: # (hash); comment
statement: import statement: import
A path configuration file is a file whose name has the form :file:`{name}.pth` A path configuration file is a file whose name has the form :file:`{name}.pth`
......
...@@ -598,6 +598,9 @@ Cursor Objects ...@@ -598,6 +598,9 @@ Cursor Objects
A :class:`Cursor` instance has the following attributes and methods. A :class:`Cursor` instance has the following attributes and methods.
.. index:: single: ? (question mark); in SQL statements
.. index:: single: : (colon); in SQL statements
.. method:: execute(sql[, parameters]) .. method:: execute(sql[, parameters])
Executes an SQL statement. The SQL statement may be parameterized (i. e. Executes an SQL statement. The SQL statement may be parameterized (i. e.
......
...@@ -123,9 +123,9 @@ Comparisons ...@@ -123,9 +123,9 @@ Comparisons
pair: chaining; comparisons pair: chaining; comparisons
pair: operator; comparison pair: operator; comparison
operator: == operator: ==
operator: < operator: < (less)
operator: <= operator: <=
operator: > operator: > (greater)
operator: >= operator: >=
operator: != operator: !=
operator: is operator: is
...@@ -246,16 +246,16 @@ and imaginary parts. ...@@ -246,16 +246,16 @@ and imaginary parts.
builtin: int builtin: int
builtin: float builtin: float
builtin: complex builtin: complex
single: operator; + single: operator; + (plus)
single: +; unary operator single: + (plus); unary operator
single: +; binary operator single: + (plus); binary operator
single: operator; - single: operator; - (minus)
single: -; unary operator single: - (minus); unary operator
single: -; binary operator single: - (minus); binary operator
operator: * operator: * (asterisk)
operator: / operator: / (slash)
operator: // operator: //
operator: % operator: % (percent)
operator: ** operator: **
Python fully supports mixed arithmetic: when a binary arithmetic operator has Python fully supports mixed arithmetic: when a binary arithmetic operator has
...@@ -391,12 +391,12 @@ Bitwise Operations on Integer Types ...@@ -391,12 +391,12 @@ Bitwise Operations on Integer Types
pair: bitwise; operations pair: bitwise; operations
pair: shifting; operations pair: shifting; operations
pair: masking; operations pair: masking; operations
operator: | operator: | (vertical bar)
operator: ^ operator: ^ (caret)
operator: & operator: & (ampersand)
operator: << operator: <<
operator: >> operator: >>
operator: ~ operator: ~ (tilde)
Bitwise operations only make sense for integers. The result of bitwise Bitwise operations only make sense for integers. The result of bitwise
operations is calculated as though carried out in two's complement with an operations is calculated as though carried out in two's complement with an
...@@ -2119,7 +2119,7 @@ expression support in the :mod:`re` module). ...@@ -2119,7 +2119,7 @@ expression support in the :mod:`re` module).
single: string; interpolation, printf single: string; interpolation, printf
single: printf-style formatting single: printf-style formatting
single: sprintf-style formatting single: sprintf-style formatting
single: %; printf-style formatting single: % (percent); printf-style formatting
.. note:: .. note::
...@@ -2148,8 +2148,7 @@ components, which must occur in this order: ...@@ -2148,8 +2148,7 @@ components, which must occur in this order:
#. The ``'%'`` character, which marks the start of the specifier. #. The ``'%'`` character, which marks the start of the specifier.
.. index:: .. index::
single: (; in printf-style formatting single: () (parentheses); in printf-style formatting
single: ); in printf-style formatting
#. Mapping key (optional), consisting of a parenthesised sequence of characters #. Mapping key (optional), consisting of a parenthesised sequence of characters
(for example, ``(somename)``). (for example, ``(somename)``).
...@@ -2157,13 +2156,13 @@ components, which must occur in this order: ...@@ -2157,13 +2156,13 @@ components, which must occur in this order:
#. Conversion flags (optional), which affect the result of some conversion #. Conversion flags (optional), which affect the result of some conversion
types. types.
.. index:: single: *; in printf-style formatting .. index:: single: * (asterisk); in printf-style formatting
#. Minimum field width (optional). If specified as an ``'*'`` (asterisk), the #. Minimum field width (optional). If specified as an ``'*'`` (asterisk), the
actual width is read from the next element of the tuple in *values*, and the actual width is read from the next element of the tuple in *values*, and the
object to convert comes after the minimum field width and optional precision. object to convert comes after the minimum field width and optional precision.
.. index:: single: .; in printf-style formatting .. index:: single: . (dot); in printf-style formatting
#. Precision (optional), given as a ``'.'`` (dot) followed by the precision. If #. Precision (optional), given as a ``'.'`` (dot) followed by the precision. If
specified as ``'*'`` (an asterisk), the actual precision is read from the next specified as ``'*'`` (an asterisk), the actual precision is read from the next
...@@ -2189,9 +2188,9 @@ sequential parameter list). ...@@ -2189,9 +2188,9 @@ sequential parameter list).
The conversion flag characters are: The conversion flag characters are:
.. index:: .. index::
single: #; in printf-style formatting single: # (hash); in printf-style formatting
single: -; in printf-style formatting single: - (minus); in printf-style formatting
single: +; in printf-style formatting single: + (plus); in printf-style formatting
single: space; in printf-style formatting single: space; in printf-style formatting
+---------+---------------------------------------------------------------------+ +---------+---------------------------------------------------------------------+
...@@ -3256,7 +3255,7 @@ place, and instead produce new objects. ...@@ -3256,7 +3255,7 @@ place, and instead produce new objects.
single: bytearray; interpolation single: bytearray; interpolation
single: printf-style formatting single: printf-style formatting
single: sprintf-style formatting single: sprintf-style formatting
single: %; printf-style formatting single: % (percent); printf-style formatting
.. note:: .. note::
...@@ -3283,8 +3282,7 @@ components, which must occur in this order: ...@@ -3283,8 +3282,7 @@ components, which must occur in this order:
#. The ``'%'`` character, which marks the start of the specifier. #. The ``'%'`` character, which marks the start of the specifier.
.. index:: .. index::
single: (; in printf-style formatting single: () (parentheses); in printf-style formatting
single: ); in printf-style formatting
#. Mapping key (optional), consisting of a parenthesised sequence of characters #. Mapping key (optional), consisting of a parenthesised sequence of characters
(for example, ``(somename)``). (for example, ``(somename)``).
...@@ -3292,13 +3290,13 @@ components, which must occur in this order: ...@@ -3292,13 +3290,13 @@ components, which must occur in this order:
#. Conversion flags (optional), which affect the result of some conversion #. Conversion flags (optional), which affect the result of some conversion
types. types.
.. index:: single: *; in printf-style formatting .. index:: single: * (asterisk); in printf-style formatting
#. Minimum field width (optional). If specified as an ``'*'`` (asterisk), the #. Minimum field width (optional). If specified as an ``'*'`` (asterisk), the
actual width is read from the next element of the tuple in *values*, and the actual width is read from the next element of the tuple in *values*, and the
object to convert comes after the minimum field width and optional precision. object to convert comes after the minimum field width and optional precision.
.. index:: single: .; in printf-style formatting .. index:: single: . (dot); in printf-style formatting
#. Precision (optional), given as a ``'.'`` (dot) followed by the precision. If #. Precision (optional), given as a ``'.'`` (dot) followed by the precision. If
specified as ``'*'`` (an asterisk), the actual precision is read from the next specified as ``'*'`` (an asterisk), the actual precision is read from the next
...@@ -3324,9 +3322,9 @@ sequential parameter list). ...@@ -3324,9 +3322,9 @@ sequential parameter list).
The conversion flag characters are: The conversion flag characters are:
.. index:: .. index::
single: #; in printf-style formatting single: # (hash); in printf-style formatting
single: -; in printf-style formatting single: - (minus); in printf-style formatting
single: +; in printf-style formatting single: + (plus); in printf-style formatting
single: space; in printf-style formatting single: space; in printf-style formatting
+---------+---------------------------------------------------------------------+ +---------+---------------------------------------------------------------------+
......
...@@ -193,13 +193,11 @@ related to that of :ref:`formatted string literals <f-strings>`, but ...@@ -193,13 +193,11 @@ related to that of :ref:`formatted string literals <f-strings>`, but
there are differences. there are differences.
.. index:: .. index::
single: {; in string formatting single: {} (curly brackets); in string formatting
single: }; in string formatting single: . (dot); in string formatting
single: .; in string formatting single: [] (square brackets); in string formatting
single: [; in string formatting single: ! (exclamation); in string formatting
single: ]; in string formatting single: : (colon); in string formatting
single: !; in string formatting
single: :; in string formatting
Format strings contain "replacement fields" surrounded by curly braces ``{}``. Format strings contain "replacement fields" surrounded by curly braces ``{}``.
Anything that is not contained in braces is considered literal text, which is Anything that is not contained in braces is considered literal text, which is
...@@ -333,10 +331,10 @@ affect the :func:`format` function. ...@@ -333,10 +331,10 @@ affect the :func:`format` function.
The meaning of the various alignment options is as follows: The meaning of the various alignment options is as follows:
.. index:: .. index::
single: <; in string formatting single: < (less); in string formatting
single: >; in string formatting single: > (greater); in string formatting
single: =; in string formatting single: = (equals); in string formatting
single: ^; in string formatting single: ^ (caret); in string formatting
+---------+----------------------------------------------------------+ +---------+----------------------------------------------------------+
| Option | Meaning | | Option | Meaning |
...@@ -365,8 +363,8 @@ The *sign* option is only valid for number types, and can be one of the ...@@ -365,8 +363,8 @@ The *sign* option is only valid for number types, and can be one of the
following: following:
.. index:: .. index::
single: +; in string formatting single: + (plus); in string formatting
single: -; in string formatting single: - (minus); in string formatting
single: space; in string formatting single: space; in string formatting
+---------+----------------------------------------------------------+ +---------+----------------------------------------------------------+
...@@ -383,7 +381,7 @@ following: ...@@ -383,7 +381,7 @@ following:
+---------+----------------------------------------------------------+ +---------+----------------------------------------------------------+
.. index:: single: #; in string formatting .. index:: single: # (hash); in string formatting
The ``'#'`` option causes the "alternate form" to be used for the The ``'#'`` option causes the "alternate form" to be used for the
conversion. The alternate form is defined differently for different conversion. The alternate form is defined differently for different
...@@ -397,7 +395,7 @@ decimal-point character appears in the result of these conversions ...@@ -397,7 +395,7 @@ decimal-point character appears in the result of these conversions
only if a digit follows it. In addition, for ``'g'`` and ``'G'`` only if a digit follows it. In addition, for ``'g'`` and ``'G'``
conversions, trailing zeros are not removed from the result. conversions, trailing zeros are not removed from the result.
.. index:: single: ,; in string formatting .. index:: single: , (comma); in string formatting
The ``','`` option signals the use of a comma for a thousands separator. The ``','`` option signals the use of a comma for a thousands separator.
For a locale aware separator, use the ``'n'`` integer presentation type For a locale aware separator, use the ``'n'`` integer presentation type
...@@ -406,7 +404,7 @@ instead. ...@@ -406,7 +404,7 @@ instead.
.. versionchanged:: 3.1 .. versionchanged:: 3.1
Added the ``','`` option (see also :pep:`378`). Added the ``','`` option (see also :pep:`378`).
.. index:: single: _; in string formatting .. index:: single: _ (underscore); in string formatting
The ``'_'`` option signals the use of an underscore for a thousands The ``'_'`` option signals the use of an underscore for a thousands
separator for floating point presentation types and for integer separator for floating point presentation types and for integer
...@@ -694,7 +692,7 @@ formatting facilities in Python. As an example of a library built on template ...@@ -694,7 +692,7 @@ formatting facilities in Python. As an example of a library built on template
strings for i18n, see the strings for i18n, see the
`flufl.i18n <http://flufli18n.readthedocs.io/en/latest/>`_ package. `flufl.i18n <http://flufli18n.readthedocs.io/en/latest/>`_ package.
.. index:: single: $; in template strings .. index:: single: $ (dollar); in template strings
Template strings support ``$``-based substitutions, using the following rules: Template strings support ``$``-based substitutions, using the following rules:
......
...@@ -118,11 +118,11 @@ order, and properly aligned by skipping pad bytes if necessary (according to the ...@@ -118,11 +118,11 @@ order, and properly aligned by skipping pad bytes if necessary (according to the
rules used by the C compiler). rules used by the C compiler).
.. index:: .. index::
single: @; in struct format strings single: @ (at); in struct format strings
single: =; in struct format strings single: = (equals); in struct format strings
single: <; in struct format strings single: < (less); in struct format strings
single: >; in struct format strings single: > (greater); in struct format strings
single: !; in struct format strings single: ! (exclamation); in struct format strings
Alternatively, the first character of the format string can be used to indicate Alternatively, the first character of the format string can be used to indicate
the byte order, size and alignment of the packed data, according to the the byte order, size and alignment of the packed data, according to the
...@@ -247,6 +247,8 @@ platform-dependent. ...@@ -247,6 +247,8 @@ platform-dependent.
Notes: Notes:
(1) (1)
.. index:: single: ? (question mark); in struct format strings
The ``'?'`` conversion code corresponds to the :c:type:`_Bool` type defined by The ``'?'`` conversion code corresponds to the :c:type:`_Bool` type defined by
C99. If this type is not available, it is simulated using a :c:type:`char`. In C99. If this type is not available, it is simulated using a :c:type:`char`. In
standard mode, it is always represented by one byte. standard mode, it is always represented by one byte.
...@@ -329,6 +331,8 @@ are used. Note that for :func:`unpack`, the ``'p'`` format character consumes ...@@ -329,6 +331,8 @@ are used. Note that for :func:`unpack`, the ``'p'`` format character consumes
``count`` bytes, but that the string returned can never contain more than 255 ``count`` bytes, but that the string returned can never contain more than 255
bytes. bytes.
.. index:: single: ? (question mark); in struct format strings
For the ``'?'`` format character, the return value is either :const:`True` or For the ``'?'`` format character, the return value is either :const:`True` or
:const:`False`. When packing, the truth value of the argument object is used. :const:`False`. When packing, the truth value of the argument object is used.
Either 0 or 1 in the native or standard bool representation will be packed, and Either 0 or 1 in the native or standard bool representation will be packed, and
......
...@@ -370,7 +370,7 @@ Functions ...@@ -370,7 +370,7 @@ Functions
.. index:: .. index::
single: %; datetime format single: % (percent); datetime format
.. function:: strftime(format[, t]) .. function:: strftime(format[, t])
...@@ -504,7 +504,7 @@ Functions ...@@ -504,7 +504,7 @@ Functions
.. index:: .. index::
single: %; datetime format single: % (percent); datetime format
.. function:: strptime(string[, format]) .. function:: strptime(string[, format])
......
...@@ -262,6 +262,8 @@ To make a widget in Tk, the command is always of the form:: ...@@ -262,6 +262,8 @@ To make a widget in Tk, the command is always of the form::
*classCommand* *classCommand*
denotes which kind of widget to make (a button, a label, a menu...) denotes which kind of widget to make (a button, a label, a menu...)
.. index:: single: . (dot); in Tkinter
*newPathname* *newPathname*
is the new name for this widget. All names in Tk must be unique. To help is the new name for this widget. All names in Tk must be unique. To help
enforce this, widgets in Tk are named with *pathnames*, just like files in a enforce this, widgets in Tk are named with *pathnames*, just like files in a
......
...@@ -47,7 +47,7 @@ The module defines the following functions: ...@@ -47,7 +47,7 @@ The module defines the following functions:
* it prints the exception *etype* and *value* after the stack trace * it prints the exception *etype* and *value* after the stack trace
.. index:: single: ^; caret .. index:: single: ^ (caret); marker
* if *type(value)* is :exc:`SyntaxError` and *value* has the appropriate * if *type(value)* is :exc:`SyntaxError` and *value* has the appropriate
format, it prints the line where the syntax error occurred with a caret format, it prints the line where the syntax error occurred with a caret
......
...@@ -225,7 +225,7 @@ This module offers the following functions: ...@@ -225,7 +225,7 @@ This module offers the following functions:
.. index:: .. index::
single: %; environment variables expansion (Windows) single: % (percent); environment variables expansion (Windows)
.. function:: ExpandEnvironmentStrings(str) .. function:: ExpandEnvironmentStrings(str)
......
...@@ -21,7 +21,7 @@ also syntactically compound statements. ...@@ -21,7 +21,7 @@ also syntactically compound statements.
.. index:: .. index::
single: clause single: clause
single: suite single: suite
single: ; single: ; (semicolon)
A compound statement consists of one or more 'clauses.' A clause consists of a A compound statement consists of one or more 'clauses.' A clause consists of a
header and a 'suite.' The clause headers of a particular compound statement are header and a 'suite.' The clause headers of a particular compound statement are
...@@ -85,7 +85,7 @@ The :keyword:`if` statement ...@@ -85,7 +85,7 @@ The :keyword:`if` statement
statement: if statement: if
keyword: elif keyword: elif
keyword: else keyword: else
single: :; compound statement single: : (colon); compound statement
The :keyword:`if` statement is used for conditional execution: The :keyword:`if` statement is used for conditional execution:
...@@ -111,7 +111,7 @@ The :keyword:`while` statement ...@@ -111,7 +111,7 @@ The :keyword:`while` statement
keyword: else keyword: else
pair: loop; statement pair: loop; statement
keyword: else keyword: else
single: :; compound statement single: : (colon); compound statement
The :keyword:`while` statement is used for repeated execution as long as an The :keyword:`while` statement is used for repeated execution as long as an
expression is true: expression is true:
...@@ -150,7 +150,7 @@ The :keyword:`for` statement ...@@ -150,7 +150,7 @@ The :keyword:`for` statement
keyword: else keyword: else
pair: target; list pair: target; list
object: sequence object: sequence
single: :; compound statement single: : (colon); compound statement
The :keyword:`for` statement is used to iterate over the elements of a sequence The :keyword:`for` statement is used to iterate over the elements of a sequence
(such as a string, tuple or list) or other iterable object: (such as a string, tuple or list) or other iterable object:
...@@ -233,7 +233,7 @@ The :keyword:`try` statement ...@@ -233,7 +233,7 @@ The :keyword:`try` statement
keyword: finally keyword: finally
keyword: else keyword: else
keyword: as keyword: as
single: :; compound statement single: : (colon); compound statement
The :keyword:`try` statement specifies exception handlers and/or cleanup code The :keyword:`try` statement specifies exception handlers and/or cleanup code
for a group of statements: for a group of statements:
...@@ -384,8 +384,8 @@ The :keyword:`with` statement ...@@ -384,8 +384,8 @@ The :keyword:`with` statement
statement: with statement: with
keyword: as keyword: as
single: as; with statement single: as; with statement
single: ,; with statement single: , (comma); with statement
single: :; compound statement single: : (colon); compound statement
The :keyword:`with` statement is used to wrap the execution of a block with The :keyword:`with` statement is used to wrap the execution of a block with
methods defined by a context manager (see section :ref:`context-managers`). methods defined by a context manager (see section :ref:`context-managers`).
...@@ -472,10 +472,9 @@ Function definitions ...@@ -472,10 +472,9 @@ Function definitions
object: function object: function
pair: function; name pair: function; name
pair: name; binding pair: name; binding
single: (; function definition single: () (parentheses); function definition
single: ); function definition single: , (comma); parameter list
single: ,; parameter list single: : (colon); compound statement
single: :; compound statement
A function definition defines a user-defined function object (see section A function definition defines a user-defined function object (see section
:ref:`types`): :ref:`types`):
...@@ -505,7 +504,7 @@ The function definition does not execute the function body; this gets executed ...@@ -505,7 +504,7 @@ The function definition does not execute the function body; this gets executed
only when the function is called. [#]_ only when the function is called. [#]_
.. index:: .. index::
single: @; function definition single: @ (at); function definition
A function definition may be wrapped by one or more :term:`decorator` expressions. A function definition may be wrapped by one or more :term:`decorator` expressions.
Decorator expressions are evaluated when the function is defined, in the scope Decorator expressions are evaluated when the function is defined, in the scope
...@@ -528,7 +527,7 @@ except that the original function is not temporarily bound to the name ``func``. ...@@ -528,7 +527,7 @@ except that the original function is not temporarily bound to the name ``func``.
.. index:: .. index::
triple: default; parameter; value triple: default; parameter; value
single: argument; function definition single: argument; function definition
single: =; function definition single: = (equals); function definition
When one or more :term:`parameters <parameter>` have the form *parameter* ``=`` When one or more :term:`parameters <parameter>` have the form *parameter* ``=``
*expression*, the function is said to have "default parameter values." For a *expression*, the function is said to have "default parameter values." For a
...@@ -555,7 +554,7 @@ e.g.:: ...@@ -555,7 +554,7 @@ e.g.::
return penguin return penguin
.. index:: .. index::
single: *; function definition single: * (asterisk); function definition
single: **; function definition single: **; function definition
Function call semantics are described in more detail in section :ref:`calls`. A Function call semantics are described in more detail in section :ref:`calls`. A
...@@ -572,7 +571,7 @@ used keyword arguments. ...@@ -572,7 +571,7 @@ used keyword arguments.
.. index:: .. index::
pair: function; annotations pair: function; annotations
single: ->; function annotations single: ->; function annotations
single: :; function annotations single: : (colon); function annotations
Parameters may have annotations of the form "``: expression``" following the Parameters may have annotations of the form "``: expression``" following the
parameter name. Any parameter may have an annotation even those of the form parameter name. Any parameter may have an annotation even those of the form
...@@ -634,10 +633,9 @@ Class definitions ...@@ -634,10 +633,9 @@ Class definitions
pair: execution; frame pair: execution; frame
single: inheritance single: inheritance
single: docstring single: docstring
single: (; class definition single: () (parentheses); class definition
single: ); class definition single: , (comma); expression list
single: ,; expression list single: : (colon); compound statement
single: :; compound statement
A class definition defines a class object (see section :ref:`types`): A class definition defines a class object (see section :ref:`types`):
...@@ -677,7 +675,7 @@ the definition syntax. ...@@ -677,7 +675,7 @@ the definition syntax.
Class creation can be customized heavily using :ref:`metaclasses <metaclasses>`. Class creation can be customized heavily using :ref:`metaclasses <metaclasses>`.
.. index:: .. index::
single: @; class definition single: @ (at); class definition
Classes can also be decorated: just like when decorating functions, :: Classes can also be decorated: just like when decorating functions, ::
......
...@@ -1835,7 +1835,7 @@ Metaclasses ...@@ -1835,7 +1835,7 @@ Metaclasses
.. index:: .. index::
single: metaclass single: metaclass
builtin: type builtin: type
single: =; class definition single: = (equals); class definition
By default, classes are constructed using :func:`type`. The class body is By default, classes are constructed using :func:`type`. The class body is
executed in a new namespace and the class name is bound locally to the executed in a new namespace and the class name is bound locally to the
......
...@@ -130,8 +130,7 @@ Parenthesized forms ...@@ -130,8 +130,7 @@ Parenthesized forms
.. index:: .. index::
single: parenthesized form single: parenthesized form
single: (; tuple display single: () (parentheses); tuple display
single: ); tuple display
A parenthesized form is an optional expression list enclosed in parentheses: A parenthesized form is an optional expression list enclosed in parentheses:
...@@ -151,7 +150,7 @@ tuple may or may not yield the same object). ...@@ -151,7 +150,7 @@ tuple may or may not yield the same object).
.. index:: .. index::
single: comma; tuple display single: comma; tuple display
pair: tuple; display pair: tuple; display
single: ,; tuple display single: , (comma); tuple display
Note that tuples are not formed by the parentheses, but rather by use of the Note that tuples are not formed by the parentheses, but rather by use of the
comma operator. The exception is the empty tuple, for which parentheses *are* comma operator. The exception is the empty tuple, for which parentheses *are*
...@@ -239,9 +238,8 @@ List displays ...@@ -239,9 +238,8 @@ List displays
pair: list; comprehensions pair: list; comprehensions
pair: empty; list pair: empty; list
object: list object: list
single: [; list expression single: [] (square brackets); list expression
single: ]; list expression single: , (comma); expression list
single: ,; expression list
A list display is a possibly empty series of expressions enclosed in square A list display is a possibly empty series of expressions enclosed in square
brackets: brackets:
...@@ -264,9 +262,8 @@ Set displays ...@@ -264,9 +262,8 @@ Set displays
.. index:: .. index::
pair: set; display pair: set; display
object: set object: set
single: {; set expression single: {} (curly brackets); set expression
single: }; set expression single: , (comma); expression list
single: ,; expression list
A set display is denoted by curly braces and distinguishable from dictionary A set display is denoted by curly braces and distinguishable from dictionary
displays by the lack of colons separating keys and values: displays by the lack of colons separating keys and values:
...@@ -293,10 +290,9 @@ Dictionary displays ...@@ -293,10 +290,9 @@ Dictionary displays
pair: dictionary; display pair: dictionary; display
key, datum, key/datum pair key, datum, key/datum pair
object: dictionary object: dictionary
single: {; dictionary expression single: {} (curly brackets); dictionary expression
single: }; dictionary expression single: : (colon); in dictionary expressions
single: :; in dictionary expressions single: , (comma); in dictionary displays
single: ,; in dictionary displays
A dictionary display is a possibly empty series of key/datum pairs enclosed in A dictionary display is a possibly empty series of key/datum pairs enclosed in
curly braces: curly braces:
...@@ -350,8 +346,7 @@ Generator expressions ...@@ -350,8 +346,7 @@ Generator expressions
.. index:: .. index::
pair: generator; expression pair: generator; expression
object: generator object: generator
single: (; generator expression single: () (parentheses); generator expression
single: ); generator expression
A generator expression is a compact generator notation in parentheses: A generator expression is a compact generator notation in parentheses:
...@@ -753,7 +748,7 @@ Attribute references ...@@ -753,7 +748,7 @@ Attribute references
.. index:: .. index::
pair: attribute; reference pair: attribute; reference
single: .; attribute reference single: . (dot); attribute reference
An attribute reference is a primary followed by a period and a name: An attribute reference is a primary followed by a period and a name:
...@@ -781,8 +776,7 @@ Subscriptions ...@@ -781,8 +776,7 @@ Subscriptions
.. index:: .. index::
single: subscription single: subscription
single: [; subscription single: [] (square brackets); subscription
single: ]; subscription
.. index:: .. index::
object: sequence object: sequence
...@@ -839,8 +833,8 @@ Slicings ...@@ -839,8 +833,8 @@ Slicings
.. index:: .. index::
single: slicing single: slicing
single: slice single: slice
single: :; slicing single: : (colon); slicing
single: ,; slicing single: , (comma); slicing
.. index:: .. index::
object: sequence object: sequence
...@@ -890,10 +884,9 @@ substituting ``None`` for missing expressions. ...@@ -890,10 +884,9 @@ substituting ``None`` for missing expressions.
object: callable object: callable
single: call single: call
single: argument; call semantics single: argument; call semantics
single: (; call single: () (parentheses); call
single: ); call single: , (comma); argument list
single: ,; argument list single: = (equals); in function calls
single: =; in function calls
.. _calls: .. _calls:
...@@ -970,7 +963,7 @@ and the argument values as corresponding values), or a (new) empty dictionary if ...@@ -970,7 +963,7 @@ and the argument values as corresponding values), or a (new) empty dictionary if
there were no excess keyword arguments. there were no excess keyword arguments.
.. index:: .. index::
single: *; in function calls single: * (asterisk); in function calls
single: unpacking; in function calls single: unpacking; in function calls
If the syntax ``*expression`` appears in the function call, ``expression`` must If the syntax ``*expression`` appears in the function call, ``expression`` must
...@@ -1142,21 +1135,21 @@ All unary arithmetic and bitwise operations have the same priority: ...@@ -1142,21 +1135,21 @@ All unary arithmetic and bitwise operations have the same priority:
.. index:: .. index::
single: negation single: negation
single: minus single: minus
single: operator; - single: operator; - (minus)
single: -; unary operator single: - (minus); unary operator
The unary ``-`` (minus) operator yields the negation of its numeric argument. The unary ``-`` (minus) operator yields the negation of its numeric argument.
.. index:: .. index::
single: plus single: plus
single: operator; + single: operator; + (plus)
single: +; unary operator single: + (plus); unary operator
The unary ``+`` (plus) operator yields its numeric argument unchanged. The unary ``+`` (plus) operator yields its numeric argument unchanged.
.. index:: .. index::
single: inversion single: inversion
operator: ~ operator: ~ (tilde)
The unary ``~`` (invert) operator yields the bitwise inversion of its integer The unary ``~`` (invert) operator yields the bitwise inversion of its integer
argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. It only argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. It only
...@@ -1188,7 +1181,7 @@ operators and one for additive operators: ...@@ -1188,7 +1181,7 @@ operators and one for additive operators:
.. index:: .. index::
single: multiplication single: multiplication
operator: * operator: * (asterisk)
The ``*`` (multiplication) operator yields the product of its arguments. The The ``*`` (multiplication) operator yields the product of its arguments. The
arguments must either both be numbers, or one argument must be an integer and arguments must either both be numbers, or one argument must be an integer and
...@@ -1198,7 +1191,7 @@ repetition is performed; a negative repetition factor yields an empty sequence. ...@@ -1198,7 +1191,7 @@ repetition is performed; a negative repetition factor yields an empty sequence.
.. index:: .. index::
single: matrix multiplication single: matrix multiplication
operator: @ operator: @ (at)
The ``@`` (at) operator is intended to be used for matrix multiplication. No The ``@`` (at) operator is intended to be used for matrix multiplication. No
builtin Python types implement this operator. builtin Python types implement this operator.
...@@ -1208,7 +1201,7 @@ builtin Python types implement this operator. ...@@ -1208,7 +1201,7 @@ builtin Python types implement this operator.
.. index:: .. index::
exception: ZeroDivisionError exception: ZeroDivisionError
single: division single: division
operator: / operator: / (slash)
operator: // operator: //
The ``/`` (division) and ``//`` (floor division) operators yield the quotient of The ``/`` (division) and ``//`` (floor division) operators yield the quotient of
...@@ -1220,7 +1213,7 @@ exception. ...@@ -1220,7 +1213,7 @@ exception.
.. index:: .. index::
single: modulo single: modulo
operator: % operator: % (percent)
The ``%`` (modulo) operator yields the remainder from the division of the first The ``%`` (modulo) operator yields the remainder from the division of the first
argument by the second. The numeric arguments are first converted to a common argument by the second. The numeric arguments are first converted to a common
...@@ -1247,8 +1240,8 @@ point number using the :func:`abs` function if appropriate. ...@@ -1247,8 +1240,8 @@ point number using the :func:`abs` function if appropriate.
.. index:: .. index::
single: addition single: addition
single: operator; + single: operator; + (plus)
single: +; binary operator single: + (plus); binary operator
The ``+`` (addition) operator yields the sum of its arguments. The arguments The ``+`` (addition) operator yields the sum of its arguments. The arguments
must either both be numbers or both be sequences of the same type. In the must either both be numbers or both be sequences of the same type. In the
...@@ -1257,8 +1250,8 @@ In the latter case, the sequences are concatenated. ...@@ -1257,8 +1250,8 @@ In the latter case, the sequences are concatenated.
.. index:: .. index::
single: subtraction single: subtraction
single: operator; - single: operator; - (minus)
single: -; binary operator single: - (minus); binary operator
The ``-`` (subtraction) operator yields the difference of its arguments. The The ``-`` (subtraction) operator yields the difference of its arguments. The
numeric arguments are first converted to a common type. numeric arguments are first converted to a common type.
...@@ -1304,7 +1297,7 @@ Each of the three bitwise operations has a different priority level: ...@@ -1304,7 +1297,7 @@ Each of the three bitwise operations has a different priority level:
.. index:: .. index::
pair: bitwise; and pair: bitwise; and
operator: & operator: & (ampersand)
The ``&`` operator yields the bitwise AND of its arguments, which must be The ``&`` operator yields the bitwise AND of its arguments, which must be
integers. integers.
...@@ -1312,7 +1305,7 @@ integers. ...@@ -1312,7 +1305,7 @@ integers.
.. index:: .. index::
pair: bitwise; xor pair: bitwise; xor
pair: exclusive; or pair: exclusive; or
operator: ^ operator: ^ (caret)
The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, which The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, which
must be integers. must be integers.
...@@ -1320,7 +1313,7 @@ must be integers. ...@@ -1320,7 +1313,7 @@ must be integers.
.. index:: .. index::
pair: bitwise; or pair: bitwise; or
pair: inclusive; or pair: inclusive; or
operator: | operator: | (vertical bar)
The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which
must be integers. must be integers.
...@@ -1334,8 +1327,8 @@ Comparisons ...@@ -1334,8 +1327,8 @@ Comparisons
.. index:: .. index::
single: comparison single: comparison
pair: C; language pair: C; language
operator: < operator: < (less)
operator: > operator: > (greater)
operator: <= operator: <=
operator: >= operator: >=
operator: == operator: ==
...@@ -1685,7 +1678,7 @@ Lambdas ...@@ -1685,7 +1678,7 @@ Lambdas
pair: lambda; expression pair: lambda; expression
pair: lambda; form pair: lambda; form
pair: anonymous; function pair: anonymous; function
single: :; lambda expression single: : (colon); lambda expression
.. productionlist:: .. productionlist::
lambda_expr: "lambda" [`parameter_list`] ":" `expression` lambda_expr: "lambda" [`parameter_list`] ":" `expression`
...@@ -1712,8 +1705,7 @@ Expression lists ...@@ -1712,8 +1705,7 @@ Expression lists
.. index:: .. index::
pair: expression; list pair: expression; list
single: comma; expression list single: , (comma); expression list
single: ,; expression list
.. productionlist:: .. productionlist::
expression_list: `expression` ("," `expression`)* [","] expression_list: `expression` ("," `expression`)* [","]
...@@ -1730,7 +1722,7 @@ evaluated from left to right. ...@@ -1730,7 +1722,7 @@ evaluated from left to right.
.. index:: .. index::
pair: iterable; unpacking pair: iterable; unpacking
single: *; in expression lists single: * (asterisk); in expression lists
An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be
an :term:`iterable`. The iterable is expanded into a sequence of items, an :term:`iterable`. The iterable is expanded into a sequence of items,
......
...@@ -65,7 +65,7 @@ Comments ...@@ -65,7 +65,7 @@ Comments
-------- --------
.. index:: comment, hash character .. index:: comment, hash character
single: #; comment single: # (hash); comment
A comment starts with a hash character (``#``) that is not part of a string A comment starts with a hash character (``#``) that is not part of a string
literal, and ends at the end of the physical line. A comment signifies the end literal, and ends at the end of the physical line. A comment signifies the end
...@@ -79,7 +79,7 @@ Encoding declarations ...@@ -79,7 +79,7 @@ Encoding declarations
--------------------- ---------------------
.. index:: source character set, encoding declarations (source file) .. index:: source character set, encoding declarations (source file)
single: #; source encoding declaration single: # (hash); source encoding declaration
If a comment in the first or second line of the Python script matches the If a comment in the first or second line of the Python script matches the
regular expression ``coding[=:]\s*([-\w.]+)``, this comment is processed as an regular expression ``coding[=:]\s*([-\w.]+)``, this comment is processed as an
...@@ -401,8 +401,8 @@ Literals are notations for constant values of some built-in types. ...@@ -401,8 +401,8 @@ Literals are notations for constant values of some built-in types.
.. index:: string literal, bytes literal, ASCII .. index:: string literal, bytes literal, ASCII
single: '; string literal single: ' (single quote); string literal
single: "; string literal single: " (double quote); string literal
single: u'; string literal single: u'; string literal
single: u"; string literal single: u"; string literal
.. _strings: .. _strings:
...@@ -495,7 +495,7 @@ retained), except that three unescaped quotes in a row terminate the literal. ( ...@@ -495,7 +495,7 @@ retained), except that three unescaped quotes in a row terminate the literal. (
"quote" is the character used to open the literal, i.e. either ``'`` or ``"``.) "quote" is the character used to open the literal, i.e. either ``'`` or ``"``.)
.. index:: physical line, escape sequence, Standard C, C .. index:: physical line, escape sequence, Standard C, C
single: \; escape sequence single: \ (backslash); escape sequence
single: \\; escape sequence single: \\; escape sequence
single: \a; escape sequence single: \a; escape sequence
single: \b; escape sequence single: \b; escape sequence
...@@ -639,10 +639,9 @@ and formatted string literals may be concatenated with plain string literals. ...@@ -639,10 +639,9 @@ and formatted string literals may be concatenated with plain string literals.
single: string; formatted literal single: string; formatted literal
single: string; interpolated literal single: string; interpolated literal
single: f-string single: f-string
single: {; in formatted string literal single: {} (curly brackets); in formatted string literal
single: }; in formatted string literal single: ! (exclamation); in formatted string literal
single: !; in formatted string literal single: : (colon); in formatted string literal
single: :; in formatted string literal
.. _f-strings: .. _f-strings:
Formatted string literals Formatted string literals
...@@ -781,7 +780,7 @@ actually an expression composed of the unary operator '``-``' and the literal ...@@ -781,7 +780,7 @@ actually an expression composed of the unary operator '``-``' and the literal
single: 0b; integer literal single: 0b; integer literal
single: 0o; integer literal single: 0o; integer literal
single: 0x; integer literal single: 0x; integer literal
single: _; in numeric literal single: _ (underscore); in numeric literal
.. _integers: .. _integers:
...@@ -824,9 +823,9 @@ Some examples of integer literals:: ...@@ -824,9 +823,9 @@ Some examples of integer literals::
.. index:: .. index::
single: .; in numeric literal single: . (dot); in numeric literal
single: e; in numeric literal single: e; in numeric literal
single: _; in numeric literal single: _ (underscore); in numeric literal
.. _floating: .. _floating:
Floating point literals Floating point literals
......
...@@ -71,7 +71,7 @@ Assignment statements ...@@ -71,7 +71,7 @@ Assignment statements
===================== =====================
.. index:: .. index::
single: =; assignment statement single: = (equals); assignment statement
pair: assignment; statement pair: assignment; statement
pair: binding; name pair: binding; name
pair: rebinding; name pair: rebinding; name
...@@ -112,12 +112,10 @@ unacceptable. The rules observed by various types and the exceptions raised are ...@@ -112,12 +112,10 @@ unacceptable. The rules observed by various types and the exceptions raised are
given with the definition of the object types (see section :ref:`types`). given with the definition of the object types (see section :ref:`types`).
.. index:: triple: target; list; assignment .. index:: triple: target; list; assignment
single: ,; in target list single: , (comma); in target list
single: *; in assignment target list single: * (asterisk); in assignment target list
single: [; in assignment target list single: [] (square brackets); in assignment target list
single: ]; in assignment target list single: () (parentheses); in assignment target list
single: (; in assignment target list
single: ); in assignment target list
Assignment of an object to a target list, optionally enclosed in parentheses or Assignment of an object to a target list, optionally enclosed in parentheses or
square brackets, is recursively defined as follows. square brackets, is recursively defined as follows.
...@@ -327,7 +325,7 @@ Annotated assignment statements ...@@ -327,7 +325,7 @@ Annotated assignment statements
.. index:: .. index::
pair: annotated; assignment pair: annotated; assignment
single: statement; assignment, annotated single: statement; assignment, annotated
single: :; annotated variable single: : (colon); annotated variable
Annotation assignment is the combination, in a single statement, Annotation assignment is the combination, in a single statement,
of a variable or attribute annotation and an optional assignment statement: of a variable or attribute annotation and an optional assignment statement:
...@@ -379,7 +377,7 @@ The :keyword:`assert` statement ...@@ -379,7 +377,7 @@ The :keyword:`assert` statement
.. index:: .. index::
statement: assert statement: assert
pair: debugging; assertions pair: debugging; assertions
single: ,; expression list single: , (comma); expression list
Assert statements are a convenient way to insert debugging assertions into a Assert statements are a convenient way to insert debugging assertions into a
program: program:
...@@ -722,7 +720,7 @@ The :keyword:`import` statement ...@@ -722,7 +720,7 @@ The :keyword:`import` statement
keyword: from keyword: from
keyword: as keyword: as
exception: ImportError exception: ImportError
single: ,; import statement single: , (comma); import statement
.. productionlist:: .. productionlist::
import_stmt: "import" `module` ["as" `identifier`] ("," `module` ["as" `identifier`])* import_stmt: "import" `module` ["as" `identifier`] ("," `module` ["as" `identifier`])*
...@@ -796,7 +794,7 @@ Examples:: ...@@ -796,7 +794,7 @@ Examples::
from foo.bar import baz # foo.bar.baz imported and bound as baz from foo.bar import baz # foo.bar.baz imported and bound as baz
from foo import attr # foo imported and foo.attr bound as attr from foo import attr # foo imported and foo.attr bound as attr
.. index:: single: *; import statement .. index:: single: * (asterisk); import statement
If the list of identifiers is replaced by a star (``'*'``), all public If the list of identifiers is replaced by a star (``'*'``), all public
names defined in the module are bound in the local namespace for the scope names defined in the module are bound in the local namespace for the scope
...@@ -932,7 +930,7 @@ The :keyword:`global` statement ...@@ -932,7 +930,7 @@ The :keyword:`global` statement
.. index:: .. index::
statement: global statement: global
triple: global; name; binding triple: global; name; binding
single: ,; identifier list single: , (comma); identifier list
.. productionlist:: .. productionlist::
global_stmt: "global" `identifier` ("," `identifier`)* global_stmt: "global" `identifier` ("," `identifier`)*
...@@ -977,7 +975,7 @@ The :keyword:`nonlocal` statement ...@@ -977,7 +975,7 @@ The :keyword:`nonlocal` statement
================================= =================================
.. index:: statement: nonlocal .. index:: statement: nonlocal
single: ,; identifier list single: , (comma); identifier list
.. productionlist:: .. productionlist::
nonlocal_stmt: "nonlocal" `identifier` ("," `identifier`)* nonlocal_stmt: "nonlocal" `identifier` ("," `identifier`)*
......
...@@ -526,7 +526,7 @@ Arbitrary Argument Lists ...@@ -526,7 +526,7 @@ Arbitrary Argument Lists
------------------------ ------------------------
.. index:: .. index::
single: *; in function calls single: * (asterisk); in function calls
Finally, the least frequently used option is to specify that a function can be Finally, the least frequently used option is to specify that a function can be
called with an arbitrary number of arguments. These arguments will be wrapped called with an arbitrary number of arguments. These arguments will be wrapped
...@@ -676,7 +676,7 @@ Function Annotations ...@@ -676,7 +676,7 @@ Function Annotations
.. index:: .. index::
pair: function; annotations pair: function; annotations
single: ->; function annotations single: ->; function annotations
single: :; function annotations single: : (colon); function annotations
:ref:`Function annotations <function>` are completely optional metadata :ref:`Function annotations <function>` are completely optional metadata
information about the types used by user-defined functions (see :pep:`3107` and information about the types used by user-defined functions (see :pep:`3107` and
......
...@@ -11,7 +11,7 @@ with a prompt are output from the interpreter. Note that a secondary prompt on a ...@@ -11,7 +11,7 @@ with a prompt are output from the interpreter. Note that a secondary prompt on a
line by itself in an example means you must type a blank line; this is used to line by itself in an example means you must type a blank line; this is used to
end a multi-line command. end a multi-line command.
.. index:: single: #; comment .. index:: single: # (hash); comment
Many of the examples in this manual, even those entered at the interactive Many of the examples in this manual, even those entered at the interactive
prompt, include comments. Comments in Python start with the hash character, prompt, include comments. Comments in Python start with the hash character,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment