[Python-checkins] peps: Some grammar and typo fixes.
eric.smith
python-checkins at python.org
Sun Sep 13 02:08:10 CEST 2015
https://hg.python.org/peps/rev/3956c944f394
changeset: 6052:3956c944f394
user: Eric V. Smith <eric at trueblade.com>
date: Sat Sep 12 20:08:18 2015 -0400
summary:
Some grammar and typo fixes.
files:
pep-0498.txt | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/pep-0498.txt b/pep-0498.txt
--- a/pep-0498.txt
+++ b/pep-0498.txt
@@ -197,9 +197,9 @@
expressions are evaluated, formatted with the existing __format__
protocol, then the results are concatenated together with the string
literals. While scanning the string for expressions, any doubled
-braces ``'{{'`` or ``'}}'`` are replaced by the corresponding single
-brace. Doubled opening braces do not signify the start of an
-expression.
+braces ``'{{'`` or ``'}}'`` inside literal portions of an f-string are
+replaced by the corresponding single brace. Doubled opening braces do
+not signify the start of an expression.
Comments, using the ``'#'`` character, are not allowed inside an
expression.
@@ -220,11 +220,11 @@
So, an f-string looks like::
- f ' <text> { <expression> <optional !s, !r, or !a> <optional : format specifier> } text ... '
+ f ' <text> { <expression> <optional !s, !r, or !a> <optional : format specifier> } <text> ... '
The resulting expression's ``__format__`` method is called with the
-format specifier. The resulting value is used when building the value
-of the f-string.
+format specifier as an argument. The resulting value is used when
+building the value of the f-string.
Expressions cannot contain ``':'`` or ``'!'`` outside of strings or
parentheses, brackets, or braces. The exception is that the ``'!='``
@@ -432,7 +432,8 @@
---------------------------------------------------------
For ease of readability, leading and trailing whitespace in
-expressions is ignored.
+expressions is ignored. This is a by-product of enclosing the
+expression in parentheses before evaluation.
Evaluation order of expressions
-------------------------------
@@ -584,8 +585,8 @@
Triple quoted f-strings are allowed. These strings are parsed just as
normal triple-quoted strings are. After parsing and decoding, the
-normal f-string logic is applied, and ``__format__()`` on each value
-is called.
+normal f-string logic is applied, and ``__format__()`` is called on
+each value.
Raw f-strings
-------------
--
Repository URL: https://hg.python.org/peps
More information about the Python-checkins
mailing list