diff --git a/pep-0498.txt b/pep-0498.txt index 7720d33f2..33de1e3eb 100644 --- a/pep-0498.txt +++ b/pep-0498.txt @@ -306,18 +306,18 @@ Leading whitespace in expressions is skipped 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 ==========