diff options
author | KatherineMichel <kthrnmichel@gmail.com> | 2017-12-19 21:03:09 (GMT) |
---|---|---|
committer | Mariatta <Mariatta@users.noreply.github.com> | 2017-12-19 21:03:09 (GMT) |
commit | f4e21a2a72f76d75a6cc6f74faf910a5f3108482 (patch) | |
tree | 7ba72566f1f82702904fbee00c8714fb872069e1 /Doc/reference | |
parent | f7686c1f5553b24e3307506a18e18f6544de94d3 (diff) | |
download | cpython-f4e21a2a72f76d75a6cc6f74faf910a5f3108482.zip cpython-f4e21a2a72f76d75a6cc6f74faf910a5f3108482.tar.gz cpython-f4e21a2a72f76d75a6cc6f74faf910a5f3108482.tar.bz2 |
Improve the F-strings and format specifier documentation (GH-4931)
Mention that the format-specifier mini language in f-strings
is the same one used by str.format.
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/lexical_analysis.rst | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst index 86e55e4..0f9cb68 100644 --- a/Doc/reference/lexical_analysis.rst +++ b/Doc/reference/lexical_analysis.rst @@ -654,10 +654,11 @@ expression or conversion result. An empty string is passed when the format specifier is omitted. The formatted result is then included in the final value of the whole string. -Top-level format specifiers may include nested replacement fields. -These nested fields may include their own conversion fields and -:ref:`format specifiers <formatspec>`, but may not include more -deeply-nested replacement fields. +Top-level format specifiers may include nested replacement fields. These nested +fields may include their own conversion fields and :ref:`format specifiers +<formatspec>`, but may not include more deeply-nested replacement fields. The +:ref:`format specifier mini-language <formatspec>` is the same as that used by +the string .format() method. Formatted string literals may be concatenated, but replacement fields cannot be split across literals. |