diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2017-12-19 21:09:19 (GMT) |
---|---|---|
committer | Mariatta <Mariatta@users.noreply.github.com> | 2017-12-19 21:09:19 (GMT) |
commit | 75d1ca26b0b820dd0f173c924887a93581ce8642 (patch) | |
tree | 371fad8b3d4f479c28ce54849f28a4f3cee91847 | |
parent | dc5770b161a5e28eeff73a406cd4eddb0676c5b5 (diff) | |
download | cpython-75d1ca26b0b820dd0f173c924887a93581ce8642.zip cpython-75d1ca26b0b820dd0f173c924887a93581ce8642.tar.gz cpython-75d1ca26b0b820dd0f173c924887a93581ce8642.tar.bz2 |
Improve the F-strings and format specifier documentation (GH-4931) (GH-4933)
Mention that the format-specifier mini language in f-strings
is the same one used by str.format.
(cherry picked from commit f4e21a2a72f76d75a6cc6f74faf910a5f3108482)
-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 30dc721..c0f2ee5 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. |