bpo-35054: Add more index entries for symbols. (GH-10064)
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst
index 638e160..592d6ca 100644
--- a/Doc/reference/compound_stmts.rst
+++ b/Doc/reference/compound_stmts.rst
@@ -21,6 +21,7 @@
.. index::
single: clause
single: suite
+ single: ;
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
@@ -84,8 +85,7 @@
statement: if
keyword: elif
keyword: else
- keyword: elif
- keyword: else
+ single: :; compound statement
The :keyword:`if` statement is used for conditional execution:
@@ -111,6 +111,7 @@
keyword: else
pair: loop; statement
keyword: else
+ single: :; compound statement
The :keyword:`while` statement is used for repeated execution as long as an
expression is true:
@@ -149,6 +150,7 @@
keyword: else
pair: target; list
object: sequence
+ single: :; compound statement
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:
@@ -229,7 +231,9 @@
statement: try
keyword: except
keyword: finally
-.. index:: keyword: except
+ keyword: else
+ keyword: as
+ single: :; compound statement
The :keyword:`try` statement specifies exception handlers and/or cleanup code
for a group of statements:
@@ -263,6 +267,8 @@
the new exception in the surrounding code and on the call stack (it is treated
as if the entire :keyword:`try` statement raised the exception).
+.. index:: single: as; except clause
+
When a matching except clause is found, the exception is assigned to the target
specified after the :keyword:`as` keyword in that except clause, if present, and
the except clause's suite is executed. All except clauses must have an
@@ -375,8 +381,11 @@
=============================
.. index::
- statement: with
- single: as; with statement
+ statement: with
+ keyword: as
+ single: as; with statement
+ single: ,; with statement
+ single: :; compound statement
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`).
@@ -463,6 +472,10 @@
object: function
pair: function; name
pair: name; binding
+ single: (; function definition
+ single: ); function definition
+ single: ,; parameter list
+ single: :; compound statement
A function definition defines a user-defined function object (see section
:ref:`types`):
@@ -492,7 +505,7 @@
only when the function is called. [#]_
.. index::
- statement: @
+ single: @; function definition
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
@@ -515,6 +528,7 @@
.. index::
triple: default; parameter; value
single: argument; function definition
+ single: =; function definition
When one or more :term:`parameters <parameter>` have the form *parameter* ``=``
*expression*, the function is said to have "default parameter values." For a
@@ -541,8 +555,8 @@
return penguin
.. index::
- statement: *
- statement: **
+ single: *; function definition
+ single: **; function definition
Function call semantics are described in more detail in section :ref:`calls`. A
function call always assigns values to all parameters mentioned in the parameter
@@ -555,7 +569,10 @@
"``*identifier``" are keyword-only parameters and may only be passed
used keyword arguments.
-.. index:: pair: function; annotations
+.. index::
+ pair: function; annotations
+ single: ->; function annotations
+ single: :; function annotations
Parameters may have annotations of the form "``: expression``" following the
parameter name. Any parameter may have an annotation even those of the form
@@ -617,6 +634,10 @@
pair: execution; frame
single: inheritance
single: docstring
+ single: (; class definition
+ single: ); class definition
+ single: ,; expression list
+ single: :; compound statement
A class definition defines a class object (see section :ref:`types`):
@@ -655,6 +676,9 @@
Class creation can be customized heavily using :ref:`metaclasses <metaclasses>`.
+.. index::
+ single: @; class definition
+
Classes can also be decorated: just like when decorating functions, ::
@f1(arg)