Fixed code typos. Minor rewording.

This commit is contained in:
Eric V. Smith 2015-08-09 17:08:17 -04:00
parent 1429bb2ec2
commit 8886508947
1 changed files with 6 additions and 6 deletions

View File

@ -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
==========