diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-10-26 08:18:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-26 08:18:57 (GMT) |
commit | e825b4e1a9bbe1d4c561f4cbbe6857653ef13a15 (patch) | |
tree | d825132fe89fdd3c0c11a0f98aba5b481377b2f5 /Doc/library | |
parent | 3b87151879adb795c3c0372832c87da84ee93974 (diff) | |
download | cpython-e825b4e1a9bbe1d4c561f4cbbe6857653ef13a15.zip cpython-e825b4e1a9bbe1d4c561f4cbbe6857653ef13a15.tar.gz cpython-e825b4e1a9bbe1d4c561f4cbbe6857653ef13a15.tar.bz2 |
[3.6] bpo-35054: Add more index entries for symbols. (GH-10064). (GH-10119)
(cherry picked from commit ddb961d2abe5d5fde76d85b21a77e4e91e0043ad)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/configparser.rst | 4 | ||||
-rw-r--r-- | Doc/library/constants.rst | 5 | ||||
-rw-r--r-- | Doc/library/datetime.rst | 3 | ||||
-rw-r--r-- | Doc/library/doctest.rst | 12 | ||||
-rw-r--r-- | Doc/library/gettext.rst | 1 | ||||
-rw-r--r-- | Doc/library/os.path.rst | 5 | ||||
-rw-r--r-- | Doc/library/os.rst | 7 | ||||
-rw-r--r-- | Doc/library/re.rst | 95 | ||||
-rw-r--r-- | Doc/library/site.rst | 4 | ||||
-rw-r--r-- | Doc/library/stdtypes.rst | 51 | ||||
-rw-r--r-- | Doc/library/string.rst | 40 | ||||
-rw-r--r-- | Doc/library/struct.rst | 7 | ||||
-rw-r--r-- | Doc/library/sys.rst | 2 | ||||
-rw-r--r-- | Doc/library/time.rst | 6 | ||||
-rw-r--r-- | Doc/library/traceback.rst | 4 | ||||
-rw-r--r-- | Doc/library/urllib.request.rst | 2 | ||||
-rw-r--r-- | Doc/library/winreg.rst | 3 |
17 files changed, 235 insertions, 16 deletions
diff --git a/Doc/library/configparser.rst b/Doc/library/configparser.rst index 4885863..88dd50c 100644 --- a/Doc/library/configparser.rst +++ b/Doc/library/configparser.rst @@ -291,6 +291,8 @@ On top of the core functionality, :class:`ConfigParser` supports interpolation. This means values can be preprocessed before returning them from ``get()`` calls. +.. index:: single: %; interpolation in configuration files + .. class:: BasicInterpolation() The default implementation used by :class:`ConfigParser`. It enables @@ -319,6 +321,8 @@ from ``get()`` calls. ``%(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(home_dir)s/lumberjack`` as the value of ``my_dir``. +.. index:: single: $; interpolation in configuration files + .. class:: ExtendedInterpolation() An alternative handler for interpolation which implements a more advanced diff --git a/Doc/library/constants.rst b/Doc/library/constants.rst index 78f1619..634ff00 100644 --- a/Doc/library/constants.rst +++ b/Doc/library/constants.rst @@ -51,10 +51,11 @@ A small number of constants live in the built-in namespace. They are: See :exc:`NotImplementedError` for details on when to use it. +.. index:: single: ...; ellipsis literal .. data:: Ellipsis - The same as ``...``. Special value used mostly in conjunction with extended - slicing syntax for user-defined container data types. + The same as the ellipsis literal "``...``". Special value used mostly in conjunction + with extended slicing syntax for user-defined container data types. .. data:: __debug__ diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index 88bc328..c2a2928 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1927,6 +1927,9 @@ Class attributes: The UTC timezone, ``timezone(timedelta(0))``. +.. index:: + single: %; datetime format + .. _strftime-strptime-behavior: :meth:`strftime` and :meth:`strptime` Behavior diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst index 587a0a0..d463356 100644 --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -321,6 +321,10 @@ but doctest isn't trying to do an exact emulation of any specific Python shell. NO!!! >>> +.. index:: + single: >>>; interpreter prompt + single: ...; interpreter prompt + Any expected output must immediately follow the final ``'>>> '`` or ``'... '`` line containing the code, and the expected output (if any) extends to the next ``'>>> '`` or all-whitespace line. @@ -481,6 +485,8 @@ 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 manually add the traceback header line to your test example. +.. index:: single: ^; caret + * For some :exc:`SyntaxError`\ s, Python displays the character position of the syntax error, using a ``^`` marker:: @@ -532,6 +538,7 @@ doctest decides whether actual output matches an example's expected output: option will probably go away, but not for several years. +.. index:: single: <BLANKLINE> .. data:: DONT_ACCEPT_BLANKLINE By default, if an expected output block contains a line containing only the @@ -551,6 +558,7 @@ doctest decides whether actual output matches an example's expected output: your source. +.. index:: single: ...; in doctests .. data:: ELLIPSIS When specified, an ellipsis marker (``...``) in the expected output can match @@ -686,6 +694,10 @@ useful unless you intend to extend :mod:`doctest` internals via subclassing: MY_FLAG = register_optionflag('MY_FLAG') +.. index:: + single: #; in doctests + single: +; in doctests + single: -; in doctests .. _doctest-directives: Directives diff --git a/Doc/library/gettext.rst b/Doc/library/gettext.rst index 407853c..93748a2 100644 --- a/Doc/library/gettext.rst +++ b/Doc/library/gettext.rst @@ -61,6 +61,7 @@ class-based API instead. *domain*, which is returned. +.. index:: single: _; gettext .. function:: gettext(message) Return the localized translation of *message*, based on the current global diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst index 06493f9..0bcc856 100644 --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -152,6 +152,8 @@ the :mod:`glob` module.) Accepts a :term:`path-like object`. +.. index:: single: ~; home directory expansion + .. function:: expanduser(path) On Unix and Windows, return the argument with an initial component of ``~`` or @@ -175,6 +177,9 @@ the :mod:`glob` module.) .. versionchanged:: 3.6 Accepts a :term:`path-like object`. +.. index:: + single: $; environment variables expansion + single: %; environment variables expansion (Windows) .. function:: expandvars(path) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index e9ee514..c88ce23 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -3867,6 +3867,7 @@ are defined for all platforms. Higher-level operations on pathnames are defined in the :mod:`os.path` module. +.. index:: single: .; in pathnames .. data:: curdir The constant string used by the operating system to refer to the current @@ -3874,6 +3875,7 @@ Higher-level operations on pathnames are defined in the :mod:`os.path` module. :mod:`os.path`. +.. index:: single: ..; in pathnames .. data:: pardir The constant string used by the operating system to refer to the parent @@ -3881,6 +3883,8 @@ Higher-level operations on pathnames are defined in the :mod:`os.path` module. :mod:`os.path`. +.. index:: single: /; in pathnames +.. index:: single: \; in pathnames (Windows) .. data:: sep The character used by the operating system to separate pathname components. @@ -3890,6 +3894,7 @@ Higher-level operations on pathnames are defined in the :mod:`os.path` module. useful. Also available via :mod:`os.path`. +.. index:: single: /; in pathnames .. data:: altsep An alternative character used by the operating system to separate pathname @@ -3898,12 +3903,14 @@ Higher-level operations on pathnames are defined in the :mod:`os.path` module. :mod:`os.path`. +.. index:: single: .; in pathnames .. data:: extsep The character which separates the base filename from the extension; for example, the ``'.'`` in :file:`os.py`. Also available via :mod:`os.path`. +.. index:: single: :; path separator (POSIX) .. data:: pathsep The character conventionally used by the operating system to separate search diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 82632b9..7390298 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -93,15 +93,21 @@ the expression ``(?:a{6})*`` matches any multiple of six ``'a'`` characters. The special characters are: +.. index:: single: .; in regular expressions + ``.`` (Dot.) In the default mode, this matches any character except a newline. If the :const:`DOTALL` flag has been specified, this matches any character including a newline. +.. index:: single: ^; in regular expressions + ``^`` (Caret.) Matches the start of the string, and in :const:`MULTILINE` mode also matches immediately after each newline. +.. index:: single: $; in regular expressions + ``$`` Matches the end of the string or just before the newline at the end of the string, and in :const:`MULTILINE` mode also matches before a newline. ``foo`` @@ -111,20 +117,31 @@ The special characters are: a single ``$`` in ``'foo\n'`` will find two (empty) matches: one just before the newline, and one at the end of the string. +.. index:: single: *; in regular expressions + ``*`` 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 by any number of 'b's. +.. index:: single: +; in regular expressions + ``+`` 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 match just 'a'. +.. index:: single: ?; in regular expressions + ``?`` Causes the resulting RE to match 0 or 1 repetitions of the preceding RE. ``ab?`` will match either 'a' or 'ab'. +.. index:: + single: *?; in regular expressions + single: +?; in regular expressions + single: ??; in regular expressions + ``*?``, ``+?``, ``??`` The ``'*'``, ``'+'``, and ``'?'`` qualifiers are all :dfn:`greedy`; they match as much text as possible. Sometimes this behaviour isn't desired; if the RE @@ -134,6 +151,10 @@ The special characters are: characters as possible will be matched. Using the RE ``<.*?>`` will match only ``'<a>'``. +.. index:: + single: {; in regular expressions + single: }; in regular expressions + ``{m}`` Specifies that exactly *m* copies of the previous RE should be matched; fewer matches cause the entire RE not to match. For example, ``a{6}`` will match @@ -155,6 +176,8 @@ The special characters are: 6-character string ``'aaaaaa'``, ``a{3,5}`` will match 5 ``'a'`` characters, while ``a{3,5}?`` will only match 3 characters. +.. index:: single: \; in regular expressions + ``\`` Either escapes special characters (permitting you to match characters like ``'*'``, ``'?'``, and so forth), or signals a special sequence; special @@ -168,12 +191,18 @@ The special characters are: is complicated and hard to understand, so it's highly recommended that you use raw strings for all but the simplest expressions. +.. index:: + single: [; in regular expressions + single: ]; in regular expressions + ``[]`` Used to indicate a set of characters. In a set: * Characters can be listed individually, e.g. ``[amk]`` will match ``'a'``, ``'m'``, or ``'k'``. + .. index:: single: -; in regular expressions + * 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, ``[0-5][0-9]`` will match all the two-digits numbers from ``00`` to ``59``, and @@ -185,10 +214,14 @@ The special characters are: ``[(+*)]`` will match any of the literal characters ``'('``, ``'+'``, ``'*'``, or ``')'``. + .. index:: single: \; in regular expressions + * Character classes such as ``\w`` or ``\S`` (defined below) are also accepted inside a set, although the characters they match depends on whether :const:`ASCII` or :const:`LOCALE` mode is in force. + .. index:: single: ^; in regular expressions + * 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 that are *not* in the set will be matched. For example, ``[^5]`` will match @@ -200,6 +233,8 @@ The special characters are: place it at the beginning of the set. For example, both ``[()[\]{}]`` and ``[]()[{}]`` will both match a parenthesis. +.. index:: single: |; in regular expressions + ``|`` ``A|B``, where *A* and *B* can be arbitrary REs, creates a regular expression that will match either *A* or *B*. An arbitrary number of REs can be separated by the @@ -211,6 +246,10 @@ The special characters are: greedy. To match a literal ``'|'``, use ``\|``, or enclose it inside a character class, as in ``[|]``. +.. index:: + single: (; in regular expressions + single: ); in regular expressions + ``(...)`` Matches whatever regular expression is inside the parentheses, and indicates the start and end of a group; the contents of a group can be retrieved after a match @@ -218,6 +257,8 @@ The special characters are: special sequence, described below. To match the literals ``'('`` or ``')'``, use ``\(`` or ``\)``, or enclose them inside a character class: ``[(]``, ``[)]``. +.. index:: single: (?; in regular expressions + ``(?...)`` This is an extension notation (a ``'?'`` following a ``'('`` is not meaningful otherwise). The first character after the ``'?'`` determines what the meaning @@ -239,6 +280,8 @@ The special characters are: :func:`re.compile` function. Flags should be used first in the expression string. +.. index:: single: (?:; in regular expressions + ``(?:...)`` A non-capturing version of regular parentheses. Matches whatever regular expression is inside the parentheses, but the substring matched by the group @@ -255,6 +298,8 @@ The special characters are: .. versionadded:: 3.6 +.. index:: single: (?P<; in regular expressions + ``(?P<name>...)`` Similar to regular parentheses, but the substring matched by the group is accessible via the symbolic group name *name*. Group names must be valid @@ -280,10 +325,14 @@ The special characters are: | | * ``\1`` | +---------------------------------------+----------------------------------+ +.. index:: single: (?P=; in regular expressions + ``(?P=name)`` A backreference to a named group; it matches whatever text was matched by the earlier group named *name*. +.. index:: single: (?#; in regular expressions + ``(?#...)`` A comment; the contents of the parentheses are simply ignored. @@ -292,11 +341,15 @@ The special characters are: called a :dfn:`lookahead assertion`. For example, ``Isaac (?=Asimov)`` will match ``'Isaac '`` only if it's followed by ``'Asimov'``. +.. index:: single: (?!; in regular expressions + ``(?!...)`` Matches if ``...`` doesn't match next. This is a :dfn:`negative lookahead assertion`. For example, ``Isaac (?!Asimov)`` will match ``'Isaac '`` only if it's *not* followed by ``'Asimov'``. +.. index:: single: (?<=; in regular expressions + ``(?<=...)`` Matches if the current position in the string is preceded by a match for ``...`` that ends at the current position. This is called a :dfn:`positive lookbehind @@ -322,6 +375,8 @@ The special characters are: .. versionchanged:: 3.5 Added support for group references of fixed length. +.. index:: single: (?<!; in regular expressions + ``(?<!...)`` Matches if the current position in the string is not preceded by a match for ``...``. This is called a :dfn:`negative lookbehind assertion`. Similar to @@ -343,6 +398,8 @@ 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 character ``'$'``. +.. index:: single: \; in regular expressions + ``\number`` Matches the contents of the group of the same number. Groups are numbered starting from 1. For example, ``(.+) \1`` matches ``'the the'`` or ``'55 55'``, @@ -353,9 +410,13 @@ character ``'$'``. ``'['`` and ``']'`` of a character class, all numeric escapes are treated as characters. +.. index:: single: \A; in regular expressions + ``\A`` Matches only at the start of the string. +.. index:: single: \b; in regular expressions + ``\b`` Matches the empty string, but only at the beginning or end of a word. A word is defined as a sequence of word characters. Note that formally, @@ -370,6 +431,8 @@ character ``'$'``. Inside a character range, ``\b`` represents the backspace character, for compatibility with Python's string literals. +.. index:: single: \B; in regular expressions + ``\B`` Matches the empty string, but only when it is *not* at the beginning or end of a word. This means that ``r'py\B'`` matches ``'python'``, ``'py3'``, @@ -379,6 +442,8 @@ character ``'$'``. be changed by using the :const:`ASCII` flag. Word boundaries are determined by the current locale if the :const:`LOCALE` flag is used. +.. index:: single: \d; in regular expressions + ``\d`` For Unicode (str) patterns: Matches any Unicode decimal digit (that is, any character in @@ -391,6 +456,8 @@ character ``'$'``. For 8-bit (bytes) patterns: Matches any decimal digit; this is equivalent to ``[0-9]``. +.. index:: single: \D; in regular expressions + ``\D`` Matches any character which is not a decimal digit. This is the opposite of ``\d``. If the :const:`ASCII` flag is used this @@ -398,6 +465,8 @@ character ``'$'``. regular expression, so in such cases using an explicit ``[^0-9]`` may be a better choice). +.. index:: single: \s; in regular expressions + ``\s`` For Unicode (str) patterns: Matches Unicode whitespace characters (which includes @@ -412,6 +481,8 @@ character ``'$'``. Matches characters considered whitespace in the ASCII character set; this is equivalent to ``[ \t\n\r\f\v]``. +.. index:: single: \S; in regular expressions + ``\S`` Matches any character which is not a whitespace character. This is the opposite of ``\s``. If the :const:`ASCII` flag is used this @@ -419,6 +490,8 @@ character ``'$'``. regular expression, so in such cases using an explicit ``[^ \t\n\r\f\v]`` may be a better choice). +.. index:: single: \w; in regular expressions + ``\w`` For Unicode (str) patterns: Matches Unicode word characters; this includes most characters @@ -434,6 +507,8 @@ character ``'$'``. used, matches characters considered alphanumeric in the current locale and the underscore. +.. index:: single: \W; in regular expressions + ``\W`` Matches any character which is not a word character. This is the opposite of ``\w``. If the :const:`ASCII` flag is used this @@ -443,9 +518,25 @@ character ``'$'``. used, matches characters considered alphanumeric in the current locale and the underscore. +.. index:: single: \Z; in regular expressions + ``\Z`` Matches only at the end of the string. +.. index:: + single: \a; in regular expressions + single: \b; in regular expressions + single: \f; in regular expressions + single: \n; in regular expressions + single: \N; in regular expressions + single: \r; in regular expressions + single: \t; in regular expressions + single: \u; in regular expressions + single: \U; in regular expressions + single: \v; in regular expressions + single: \x; in regular expressions + single: \\; in regular expressions + Most of the standard escapes supported by Python string literals are also accepted by the regular expression parser:: @@ -599,6 +690,8 @@ form. .. data:: X VERBOSE + .. index:: single: #; in regular expressions + 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 pattern and add comments. Whitespace within the pattern is ignored, except @@ -772,6 +865,8 @@ form. when not adjacent to a previous match, so ``sub('x*', '-', 'abc')`` returns ``'-a-b-c-'``. + .. index:: single: \g; in regular expressions + In string-type *repl* arguments, in addition to the character escapes and backreferences described above, ``\g<name>`` will use the substring matched by the group named ``name``, as diff --git a/Doc/library/site.rst b/Doc/library/site.rst index dabb4fe..fa69997 100644 --- a/Doc/library/site.rst +++ b/Doc/library/site.rst @@ -49,6 +49,10 @@ the key "include-system-site-packages" set to anything other than "false" (case-insensitive), the system-level prefixes will still also be searched for site-packages; otherwise they won't. +.. index:: + single: #; comment + statement: import + A path configuration file is a file whose name has the form :file:`{name}.pth` and exists in one of the four directories mentioned above; its contents are additional items (one per line) to be added to ``sys.path``. Non-existing items diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 6de7e1a..0799e5a 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -248,8 +248,12 @@ and imaginary parts. builtin: int builtin: float builtin: complex - operator: + - operator: - + single: operator; + + single: +; unary operator + single: +; binary operator + single: operator; - + single: -; unary operator + single: -; binary operator operator: * operator: / operator: // @@ -2087,8 +2091,7 @@ expression support in the :mod:`re` module). single: string; interpolation, printf single: printf-style formatting single: sprintf-style formatting - single: % formatting - single: % interpolation + single: %; printf-style formatting .. note:: @@ -2115,16 +2118,24 @@ components, which must occur in this order: #. The ``'%'`` character, which marks the start of the specifier. +.. index:: + single: (; in printf-style formatting + single: ); in printf-style formatting + #. Mapping key (optional), consisting of a parenthesised sequence of characters (for example, ``(somename)``). #. Conversion flags (optional), which affect the result of some conversion types. +.. index:: single: *; in printf-style formatting + #. 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 object to convert comes after the minimum field width and optional precision. +.. index:: single: .; in printf-style formatting + #. Precision (optional), given as a ``'.'`` (dot) followed by the precision. If specified as ``'*'`` (an asterisk), the actual precision is read from the next element of the tuple in *values*, and the value to convert comes after the @@ -2148,6 +2159,12 @@ sequential parameter list). The conversion flag characters are: +.. index:: + single: #; in printf-style formatting + single: -; in printf-style formatting + single: +; in printf-style formatting + single: space; in printf-style formatting + +---------+---------------------------------------------------------------------+ | Flag | Meaning | +=========+=====================================================================+ @@ -3182,18 +3199,17 @@ place, and instead produce new objects. ---------------------------------- .. index:: - single: formatting, bytes (%) - single: formatting, bytearray (%) - single: interpolation, bytes (%) - single: interpolation, bytearray (%) + single: formatting; bytes (%) + single: formatting; bytearray (%) + single: interpolation; bytes (%) + single: interpolation; bytearray (%) single: bytes; formatting single: bytearray; formatting single: bytes; interpolation single: bytearray; interpolation single: printf-style formatting single: sprintf-style formatting - single: % formatting - single: % interpolation + single: %; printf-style formatting .. note:: @@ -3219,16 +3235,24 @@ components, which must occur in this order: #. The ``'%'`` character, which marks the start of the specifier. +.. index:: + single: (; in printf-style formatting + single: ); in printf-style formatting + #. Mapping key (optional), consisting of a parenthesised sequence of characters (for example, ``(somename)``). #. Conversion flags (optional), which affect the result of some conversion types. +.. index:: single: *; in printf-style formatting + #. 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 object to convert comes after the minimum field width and optional precision. +.. index:: single: .; in printf-style formatting + #. Precision (optional), given as a ``'.'`` (dot) followed by the precision. If specified as ``'*'`` (an asterisk), the actual precision is read from the next element of the tuple in *values*, and the value to convert comes after the @@ -3252,6 +3276,12 @@ sequential parameter list). The conversion flag characters are: +.. index:: + single: #; in printf-style formatting + single: -; in printf-style formatting + single: +; in printf-style formatting + single: space; in printf-style formatting + +---------+---------------------------------------------------------------------+ | Flag | Meaning | +=========+=====================================================================+ @@ -4527,6 +4557,7 @@ supports no special operations. There is exactly one null object, named It is written as ``None``. +.. index:: single: ...; ellipsis literal .. _bltin-ellipsis-object: The Ellipsis Object diff --git a/Doc/library/string.rst b/Doc/library/string.rst index a87d285..674b48b 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -192,6 +192,15 @@ subclasses can define their own format string syntax). The syntax is related to that of :ref:`formatted string literals <f-strings>`, but there are differences. +.. index:: + single: {; in string formatting + single: }; in string formatting + single: .; in string formatting + single: [; in string formatting + single: ]; in string formatting + single: !; in string formatting + single: :; in string formatting + Format strings contain "replacement fields" surrounded by curly braces ``{}``. Anything that is not contained in braces is considered literal text, which is copied unchanged to the output. If you need to include a brace character in the @@ -323,6 +332,12 @@ affect the :func:`format` function. The meaning of the various alignment options is as follows: + .. index:: + single: <; in string formatting + single: >; in string formatting + single: =; in string formatting + single: ^; in string formatting + +---------+----------------------------------------------------------+ | Option | Meaning | +=========+==========================================================+ @@ -349,6 +364,11 @@ meaning in this case. The *sign* option is only valid for number types, and can be one of the following: + .. index:: + single: +; in string formatting + single: -; in string formatting + single: space; in string formatting + +---------+----------------------------------------------------------+ | Option | Meaning | +=========+==========================================================+ @@ -363,6 +383,8 @@ following: +---------+----------------------------------------------------------+ +.. index:: single: #; in string formatting + The ``'#'`` option causes the "alternate form" to be used for the conversion. The alternate form is defined differently for different types. This option is only valid for integer, float, complex and @@ -375,6 +397,8 @@ decimal-point character appears in the result of these conversions only if a digit follows it. In addition, for ``'g'`` and ``'G'`` conversions, trailing zeros are not removed from the result. +.. index:: single: ,; in string formatting + The ``','`` option signals the use of a comma for a thousands separator. For a locale aware separator, use the ``'n'`` integer presentation type instead. @@ -382,6 +406,8 @@ instead. .. versionchanged:: 3.1 Added the ``','`` option (see also :pep:`378`). +.. index:: single: _; in string formatting + The ``'_'`` option signals the use of an underscore for a thousands separator for floating point presentation types and for integer presentation type ``'d'``. For integer presentation types ``'b'``, @@ -660,9 +686,17 @@ Nesting arguments and more complex examples:: Template strings ---------------- -Templates provide simpler string substitutions as described in :pep:`292`. -Instead of the normal ``%``\ -based substitutions, Templates support ``$``\ --based substitutions, using the following rules: +Template strings provide simpler string substitutions as described in +:pep:`292`. A primary use case for template strings is for +internationalization (i18n) since in that context, the simpler syntax and +functionality makes it easier to translate than other built-in string +formatting facilities in Python. As an example of a library built on template +strings for i18n, see the +`flufl.i18n <http://flufli18n.readthedocs.io/en/latest/>`_ package. + +.. index:: single: $; in template strings + +Template strings support ``$``-based substitutions, using the following rules: * ``$$`` is an escape; it is replaced with a single ``$``. diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index cc3017b..a0679f3 100644 --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -116,6 +116,13 @@ By default, C types are represented in the machine's native format and byte order, and properly aligned by skipping pad bytes if necessary (according to the rules used by the C compiler). +.. index:: + single: @; in struct format strings + single: =; in struct format strings + single: <; in struct format strings + single: >; in struct format strings + single: !; in struct format strings + 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 following table: diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index f419c45..9198466 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -963,6 +963,8 @@ always available. .. index:: single: interpreter prompts single: prompts, interpreter + single: >>>; interpreter prompt + single: ...; interpreter prompt Strings specifying the primary and secondary prompt of the interpreter. These are only defined if the interpreter is in interactive mode. Their initial diff --git a/Doc/library/time.rst b/Doc/library/time.rst index 0624099..7839f43 100644 --- a/Doc/library/time.rst +++ b/Doc/library/time.rst @@ -308,6 +308,9 @@ Functions :pep:`475` for the rationale). +.. index:: + single: %; datetime format + .. function:: strftime(format[, t]) Convert a tuple or :class:`struct_time` representing a time as returned by @@ -439,6 +442,9 @@ Functions it is 3. +.. index:: + single: %; datetime format + .. function:: strptime(string[, format]) Parse a string representing a time according to a format. The return value diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index 7ac3cacd..a21ef8e 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -44,7 +44,11 @@ The module defines the following functions: * if *tb* is not ``None``, it prints a header ``Traceback (most recent call last):`` + * it prints the exception *etype* and *value* after the stack trace + + .. index:: single: ^; caret + * if *type(value)* is :exc:`SyntaxError` and *value* has the appropriate format, it prints the line where the syntax error occurred with a caret indicating the approximate position of the error. diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index 0890f74..8af97f0 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -297,7 +297,7 @@ The following classes are provided: Cause requests to go through a proxy. If *proxies* is given, it must be a dictionary mapping protocol names to URLs of proxies. The default is to read the list of proxies from the environment variables - :envvar:`<protocol>_proxy`. If no proxy environment variables are set, then + ``<protocol>_proxy``. If no proxy environment variables are set, then in a Windows environment proxy settings are obtained from the registry's Internet Settings section, and in a Mac OS X environment proxy information is retrieved from the OS X System Configuration Framework. diff --git a/Doc/library/winreg.rst b/Doc/library/winreg.rst index 14f7896..99be47f 100644 --- a/Doc/library/winreg.rst +++ b/Doc/library/winreg.rst @@ -224,6 +224,9 @@ This module offers the following functions: See :ref:`above <exception-changed>`. +.. index:: + single: %; environment variables expansion (Windows) + .. function:: ExpandEnvironmentStrings(str) Expands environment variable placeholders ``%NAME%`` in strings like |