summaryrefslogtreecommitdiff
path: root/Doc/reference
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-10-28 19:35:32 +0200
committerGitHub <noreply@github.com>2018-10-28 19:35:32 +0200
commit5b2e1cfde28cce7f4b9275ec1b3757c561eef94e (patch)
tree955de5e376a4b345ca90ad4f50d2a61ab9ae9301 /Doc/reference
parentf29bded3d3b0de63b45819eec292f5007c0cd3cf (diff)
downloadcpython-git-5b2e1cfde28cce7f4b9275ec1b3757c561eef94e.tar.gz
[3.6] bpo-35054: Add yet more index entries for symbols. (GH-10121). (GH-10182)
(cherry picked from commit 913876d824d969f8c7431e8a9d4610a9a11a786e)
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/compound_stmts.rst38
-rw-r--r--Doc/reference/datamodel.rst2
-rw-r--r--Doc/reference/expressions.rst86
-rw-r--r--Doc/reference/lexical_analysis.rst23
-rw-r--r--Doc/reference/simple_stmts.rst24
5 files changed, 80 insertions, 93 deletions
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst
index 605b919fe4..f8d7afbe49 100644
--- a/Doc/reference/compound_stmts.rst
+++ b/Doc/reference/compound_stmts.rst
@@ -21,7 +21,7 @@ also syntactically compound statements.
.. index::
single: clause
single: suite
- single: ;
+ single: ; (semicolon)
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
@@ -85,7 +85,7 @@ The :keyword:`if` statement
statement: if
keyword: elif
keyword: else
- single: :; compound statement
+ single: : (colon); compound statement
The :keyword:`if` statement is used for conditional execution:
@@ -111,7 +111,7 @@ The :keyword:`while` statement
keyword: else
pair: loop; statement
keyword: else
- single: :; compound statement
+ single: : (colon); compound statement
The :keyword:`while` statement is used for repeated execution as long as an
expression is true:
@@ -150,7 +150,7 @@ The :keyword:`for` statement
keyword: else
pair: target; list
object: sequence
- single: :; compound statement
+ single: : (colon); 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:
@@ -233,7 +233,7 @@ The :keyword:`try` statement
keyword: finally
keyword: else
keyword: as
- single: :; compound statement
+ single: : (colon); compound statement
The :keyword:`try` statement specifies exception handlers and/or cleanup code
for a group of statements:
@@ -383,8 +383,8 @@ The :keyword:`with` statement
statement: with
keyword: as
single: as; with statement
- single: ,; with statement
- single: :; compound statement
+ single: , (comma); with statement
+ single: : (colon); 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`).
@@ -471,10 +471,9 @@ Function definitions
object: function
pair: function; name
pair: name; binding
- single: (; function definition
- single: ); function definition
- single: ,; parameter list
- single: :; compound statement
+ single: () (parentheses); function definition
+ single: , (comma); parameter list
+ single: : (colon); compound statement
A function definition defines a user-defined function object (see section
:ref:`types`):
@@ -504,7 +503,7 @@ The function definition does not execute the function body; this gets executed
only when the function is called. [#]_
.. index::
- single: @; function definition
+ single: @ (at); 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
@@ -527,7 +526,7 @@ except that the original function is not temporarily bound to the name ``func``.
.. index::
triple: default; parameter; value
single: argument; function definition
- single: =; function definition
+ single: = (equals); 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
@@ -554,7 +553,7 @@ e.g.::
return penguin
.. index::
- single: *; function definition
+ single: * (asterisk); function definition
single: **; function definition
Function call semantics are described in more detail in section :ref:`calls`. A
@@ -571,7 +570,7 @@ used keyword arguments.
.. index::
pair: function; annotations
single: ->; function annotations
- single: :; function annotations
+ single: : (colon); 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
@@ -620,10 +619,9 @@ Class definitions
pair: execution; frame
single: inheritance
single: docstring
- single: (; class definition
- single: ); class definition
- single: ,; expression list
- single: :; compound statement
+ single: () (parentheses); class definition
+ single: , (comma); expression list
+ single: : (colon); compound statement
A class definition defines a class object (see section :ref:`types`):
@@ -663,7 +661,7 @@ the definition syntax.
Class creation can be customized heavily using :ref:`metaclasses <metaclasses>`.
.. index::
- single: @; class definition
+ single: @ (at); class definition
Classes can also be decorated: just like when decorating functions, ::
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 9c0048e113..18067c2d09 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -1770,7 +1770,7 @@ Metaclasses
.. index::
single: metaclass
builtin: type
- single: =; class definition
+ single: = (equals); class definition
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
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index 287e5ceff9..879eba8f58 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -130,8 +130,7 @@ Parenthesized forms
.. index::
single: parenthesized form
- single: (; tuple display
- single: ); tuple display
+ single: () (parentheses); tuple display
A parenthesized form is an optional expression list enclosed in parentheses:
@@ -151,7 +150,7 @@ tuple may or may not yield the same object).
.. index::
single: comma; 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
comma operator. The exception is the empty tuple, for which parentheses *are*
@@ -220,9 +219,8 @@ List displays
pair: list; comprehensions
pair: empty; list
object: list
- single: [; list expression
- single: ]; list expression
- single: ,; expression list
+ single: [] (square brackets); list expression
+ single: , (comma); expression list
A list display is a possibly empty series of expressions enclosed in square
brackets:
@@ -245,9 +243,8 @@ Set displays
.. index::
pair: set; display
object: set
- single: {; set expression
- single: }; set expression
- single: ,; expression list
+ single: {} (curly brackets); set expression
+ single: , (comma); expression list
A set display is denoted by curly braces and distinguishable from dictionary
displays by the lack of colons separating keys and values:
@@ -274,10 +271,9 @@ Dictionary displays
pair: dictionary; display
key, datum, key/datum pair
object: dictionary
- single: {; dictionary expression
- single: }; dictionary expression
- single: :; in dictionary expressions
- single: ,; in dictionary displays
+ single: {} (curly brackets); dictionary expression
+ single: : (colon); in dictionary expressions
+ single: , (comma); in dictionary displays
A dictionary display is a possibly empty series of key/datum pairs enclosed in
curly braces:
@@ -331,8 +327,7 @@ Generator expressions
.. index::
pair: generator; expression
object: generator
- single: (; generator expression
- single: ); generator expression
+ single: () (parentheses); generator expression
A generator expression is a compact generator notation in parentheses:
@@ -711,7 +706,7 @@ Attribute references
.. index::
pair: attribute; reference
- single: .; attribute reference
+ single: . (dot); attribute reference
An attribute reference is a primary followed by a period and a name:
@@ -739,8 +734,7 @@ Subscriptions
.. index::
single: subscription
- single: [; subscription
- single: ]; subscription
+ single: [] (square brackets); subscription
.. index::
object: sequence
@@ -797,8 +791,8 @@ Slicings
.. index::
single: slicing
single: slice
- single: :; slicing
- single: ,; slicing
+ single: : (colon); slicing
+ single: , (comma); slicing
.. index::
object: sequence
@@ -848,10 +842,9 @@ substituting ``None`` for missing expressions.
object: callable
single: call
single: argument; call semantics
- single: (; call
- single: ); call
- single: ,; argument list
- single: =; in function calls
+ single: () (parentheses); call
+ single: , (comma); argument list
+ single: = (equals); in function calls
.. _calls:
@@ -928,7 +921,7 @@ and the argument values as corresponding values), or a (new) empty dictionary if
there were no excess keyword arguments.
.. index::
- single: *; in function calls
+ single: * (asterisk); in function calls
single: unpacking; in function calls
If the syntax ``*expression`` appears in the function call, ``expression`` must
@@ -1100,21 +1093,21 @@ All unary arithmetic and bitwise operations have the same priority:
.. index::
single: negation
single: minus
- single: operator; -
- single: -; unary operator
+ single: operator; - (minus)
+ single: - (minus); unary operator
The unary ``-`` (minus) operator yields the negation of its numeric argument.
.. index::
single: plus
- single: operator; +
- single: +; unary operator
+ single: operator; + (plus)
+ single: + (plus); unary operator
The unary ``+`` (plus) operator yields its numeric argument unchanged.
.. index::
single: inversion
- operator: ~
+ operator: ~ (tilde)
The unary ``~`` (invert) operator yields the bitwise inversion of its integer
argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. It only
@@ -1146,7 +1139,7 @@ operators and one for additive operators:
.. index::
single: multiplication
- operator: *
+ operator: * (asterisk)
The ``*`` (multiplication) operator yields the product of its arguments. The
arguments must either both be numbers, or one argument must be an integer and
@@ -1156,7 +1149,7 @@ repetition is performed; a negative repetition factor yields an empty sequence.
.. index::
single: matrix multiplication
- operator: @
+ operator: @ (at)
The ``@`` (at) operator is intended to be used for matrix multiplication. No
builtin Python types implement this operator.
@@ -1166,7 +1159,7 @@ builtin Python types implement this operator.
.. index::
exception: ZeroDivisionError
single: division
- operator: /
+ operator: / (slash)
operator: //
The ``/`` (division) and ``//`` (floor division) operators yield the quotient of
@@ -1178,7 +1171,7 @@ exception.
.. index::
single: modulo
- operator: %
+ operator: % (percent)
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
@@ -1205,8 +1198,8 @@ point number using the :func:`abs` function if appropriate.
.. index::
single: addition
- single: operator; +
- single: +; binary operator
+ single: operator; + (plus)
+ single: + (plus); binary operator
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
@@ -1215,8 +1208,8 @@ In the latter case, the sequences are concatenated.
.. index::
single: subtraction
- single: operator; -
- single: -; binary operator
+ single: operator; - (minus)
+ single: - (minus); binary operator
The ``-`` (subtraction) operator yields the difference of its arguments. The
numeric arguments are first converted to a common type.
@@ -1267,7 +1260,7 @@ Each of the three bitwise operations has a different priority level:
.. index::
pair: bitwise; and
- operator: &
+ operator: & (ampersand)
The ``&`` operator yields the bitwise AND of its arguments, which must be
integers.
@@ -1275,7 +1268,7 @@ integers.
.. index::
pair: bitwise; xor
pair: exclusive; or
- operator: ^
+ operator: ^ (caret)
The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, which
must be integers.
@@ -1283,7 +1276,7 @@ must be integers.
.. index::
pair: bitwise; or
pair: inclusive; or
- operator: |
+ operator: | (vertical bar)
The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which
must be integers.
@@ -1297,8 +1290,8 @@ Comparisons
.. index::
single: comparison
pair: C; language
- operator: <
- operator: >
+ operator: < (less)
+ operator: > (greater)
operator: <=
operator: >=
operator: ==
@@ -1649,7 +1642,7 @@ Lambdas
pair: lambda; expression
pair: lambda; form
pair: anonymous; function
- single: :; lambda expression
+ single: : (colon); lambda expression
.. productionlist::
lambda_expr: "lambda" [`parameter_list`] ":" `expression`
@@ -1676,8 +1669,7 @@ Expression lists
.. index::
pair: expression; list
- single: comma; expression list
- single: ,; expression list
+ single: , (comma); expression list
.. productionlist::
expression_list: `expression` ("," `expression`)* [","]
@@ -1694,7 +1686,7 @@ evaluated from left to right.
.. index::
pair: iterable; unpacking
- single: *; in expression lists
+ single: * (asterisk); in expression lists
An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be
an :term:`iterable`. The iterable is expanded into a sequence of items,
diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst
index 4a60525890..bee02443e6 100644
--- a/Doc/reference/lexical_analysis.rst
+++ b/Doc/reference/lexical_analysis.rst
@@ -65,7 +65,7 @@ Comments
--------
.. index:: comment, hash character
- single: #; comment
+ single: # (hash); comment
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
@@ -79,7 +79,7 @@ Encoding declarations
---------------------
.. 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
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.
.. index:: string literal, bytes literal, ASCII
- single: '; string literal
- single: "; string literal
+ single: ' (single quote); string literal
+ single: " (double quote); string literal
single: u'; string literal
single: u"; string literal
.. _strings:
@@ -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 ``"``.)
.. index:: physical line, escape sequence, Standard C, C
- single: \; escape sequence
+ single: \ (backslash); escape sequence
single: \\; escape sequence
single: \a; escape sequence
single: \b; escape sequence
@@ -636,10 +636,9 @@ and formatted string literals may be concatenated with plain string literals.
single: string; formatted literal
single: string; interpolated literal
single: f-string
- single: {; in formatted string literal
- single: }; in formatted string literal
- single: !; in formatted string literal
- single: :; in formatted string literal
+ single: {} (curly brackets); in formatted string literal
+ single: ! (exclamation); in formatted string literal
+ single: : (colon); in formatted string literal
.. _f-strings:
Formatted string literals
@@ -778,7 +777,7 @@ actually an expression composed of the unary operator '``-``' and the literal
single: 0b; integer literal
single: 0o; integer literal
single: 0x; integer literal
- single: _; in numeric literal
+ single: _ (underscore); in numeric literal
.. _integers:
@@ -821,9 +820,9 @@ Some examples of integer literals::
.. index::
- single: .; in numeric literal
+ single: . (dot); in numeric literal
single: e; in numeric literal
- single: _; in numeric literal
+ single: _ (underscore); in numeric literal
.. _floating:
Floating point literals
diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst
index fb55138775..9246939dbd 100644
--- a/Doc/reference/simple_stmts.rst
+++ b/Doc/reference/simple_stmts.rst
@@ -71,7 +71,7 @@ Assignment statements
=====================
.. index::
- single: =; assignment statement
+ single: = (equals); assignment statement
pair: assignment; statement
pair: binding; name
pair: rebinding; name
@@ -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`).
.. index:: triple: target; list; assignment
- single: ,; in target list
- single: *; in assignment target list
- single: [; in assignment target list
- single: ]; in assignment target list
- single: (; in assignment target list
- single: ); in assignment target list
+ single: , (comma); in target list
+ single: * (asterisk); in assignment target list
+ single: [] (square brackets); in assignment target list
+ single: () (parentheses); in assignment target list
Assignment of an object to a target list, optionally enclosed in parentheses or
square brackets, is recursively defined as follows.
@@ -327,7 +325,7 @@ Annotated assignment statements
.. index::
pair: annotated; assignment
single: statement; assignment, annotated
- single: :; annotated variable
+ single: : (colon); annotated variable
Annotation assignment is the combination, in a single statement,
of a variable or attribute annotation and an optional assignment statement:
@@ -379,7 +377,7 @@ The :keyword:`assert` statement
.. index::
statement: assert
pair: debugging; assertions
- single: ,; expression list
+ single: , (comma); expression list
Assert statements are a convenient way to insert debugging assertions into a
program:
@@ -723,7 +721,7 @@ The :keyword:`import` statement
keyword: from
keyword: as
exception: ImportError
- single: ,; import statement
+ single: , (comma); import statement
.. productionlist::
import_stmt: "import" `module` ["as" `identifier`] ("," `module` ["as" `identifier`])*
@@ -797,7 +795,7 @@ Examples::
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
-.. index:: single: *; import statement
+.. index:: single: * (asterisk); import statement
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
@@ -930,7 +928,7 @@ The :keyword:`global` statement
.. index::
statement: global
triple: global; name; binding
- single: ,; identifier list
+ single: , (comma); identifier list
.. productionlist::
global_stmt: "global" `identifier` ("," `identifier`)*
@@ -975,7 +973,7 @@ The :keyword:`nonlocal` statement
=================================
.. index:: statement: nonlocal
- single: ,; identifier list
+ single: , (comma); identifier list
.. productionlist::
nonlocal_stmt: "nonlocal" `identifier` ("," `identifier`)*