diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-10-28 11:41:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-28 11:41:26 (GMT) |
commit | 913876d824d969f8c7431e8a9d4610a9a11a786e (patch) | |
tree | f98ec4ccbb5f2db38d2ea62e1583745db2957c0b /Doc/reference/expressions.rst | |
parent | 95f68b10d5c9852ef4dcf5b9f2ae15fdf74e8f1c (diff) | |
download | cpython-913876d824d969f8c7431e8a9d4610a9a11a786e.zip cpython-913876d824d969f8c7431e8a9d4610a9a11a786e.tar.gz cpython-913876d824d969f8c7431e8a9d4610a9a11a786e.tar.bz2 |
bpo-35054: Add yet more index entries for symbols. (GH-10121)
Diffstat (limited to 'Doc/reference/expressions.rst')
-rw-r--r-- | Doc/reference/expressions.rst | 86 |
1 files changed, 39 insertions, 47 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index fdbbba1..fd7df4c 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* @@ -239,9 +238,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: @@ -264,9 +262,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: @@ -293,10 +290,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: @@ -350,8 +346,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: @@ -753,7 +748,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: @@ -781,8 +776,7 @@ Subscriptions .. index:: single: subscription - single: [; subscription - single: ]; subscription + single: [] (square brackets); subscription .. index:: object: sequence @@ -839,8 +833,8 @@ Slicings .. index:: single: slicing single: slice - single: :; slicing - single: ,; slicing + single: : (colon); slicing + single: , (comma); slicing .. index:: object: sequence @@ -890,10 +884,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: @@ -970,7 +963,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 @@ -1142,21 +1135,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 @@ -1188,7 +1181,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 @@ -1198,7 +1191,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. @@ -1208,7 +1201,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 @@ -1220,7 +1213,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 @@ -1247,8 +1240,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 @@ -1257,8 +1250,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. @@ -1304,7 +1297,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. @@ -1312,7 +1305,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. @@ -1320,7 +1313,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. @@ -1334,8 +1327,8 @@ Comparisons .. index:: single: comparison pair: C; language - operator: < - operator: > + operator: < (less) + operator: > (greater) operator: <= operator: >= operator: == @@ -1685,7 +1678,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` @@ -1712,8 +1705,7 @@ Expression lists .. index:: pair: expression; list - single: comma; expression list - single: ,; expression list + single: , (comma); expression list .. productionlist:: expression_list: `expression` ("," `expression`)* [","] @@ -1730,7 +1722,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, |