[Python-checkins] peps: Fixed code typos. Minor rewording.
eric.smith
python-checkins at python.org
Sun Aug 9 23:08:18 CEST 2015
https://hg.python.org/peps/rev/d3695d3fc321
changeset: 5944:d3695d3fc321
user: Eric V. Smith <eric at trueblade.com>
date: Sun Aug 09 17:08:17 2015 -0400
summary:
Fixed code typos. Minor rewording.
files:
pep-0498.txt | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/pep-0498.txt b/pep-0498.txt
--- a/pep-0498.txt
+++ b/pep-0498.txt
@@ -306,18 +306,18 @@
Because expressions may begin with a left brace ('{'), there is a
problem when parsing such expressions. For example::
- >>> f'{{k:v for k, v in [(1, 2), (3, 4)}}'
- '{k:v for k, v in [(1, 2), (3, 4)}'
+ >>> f'{{k:v for k, v in [(1, 2), (3, 4)]}}'
+ '{k:v for k, v in [(1, 2), (3, 4)]}'
In this case, the doubled left braces and doubled right braces are
interpreted as single braces, and the string becomes just a normal
string literal. There is no expression evaluation being performed.
-To account for this, whitespace characters at the beginning of an
-expression are skipped::
+To allow for expressions to begin with a left brace, whitespace
+characters at the beginning of an expression are skipped::
- >>> f'{ {k:v for k, v in [(1, 2), (3, 4)}}'
- '{k:v for k, v in [(1, 2), (3, 4)}'
+ >>> f'{ {k:v for k, v in [(1, 2), (3, 4)]}}'
+ '{1: 2, 3: 4}'
Discussion
==========
--
Repository URL: https://hg.python.org/peps
More information about the Python-checkins
mailing list