Removed being able to combine 'f' with 'u'.
This commit is contained in:
parent
78c0674c85
commit
c02acaa227
11
pep-0498.txt
11
pep-0498.txt
|
@ -173,8 +173,7 @@ In source code, f-strings are string literals that are prefixed by the
|
||||||
letter 'f' or 'F'. Everywhere this PEP uses 'f', 'F' may also be
|
letter 'f' or 'F'. Everywhere this PEP uses 'f', 'F' may also be
|
||||||
used. 'f' may be combined with 'r', in either order, to produce raw
|
used. 'f' may be combined with 'r', in either order, to produce raw
|
||||||
f-string literals. 'f' may not be combined with 'b': this PEP does not
|
f-string literals. 'f' may not be combined with 'b': this PEP does not
|
||||||
propose to add binary f-strings. 'f' may also be combined with 'u', in
|
propose to add binary f-strings. 'f' may not be combined with 'u'.
|
||||||
either order, although adding 'u' has no effect.
|
|
||||||
|
|
||||||
When tokenizing source files, f-strings use the same rules as normal
|
When tokenizing source files, f-strings use the same rules as normal
|
||||||
strings, raw strings, binary strings, and triple quoted strings. That
|
strings, raw strings, binary strings, and triple quoted strings. That
|
||||||
|
@ -661,6 +660,14 @@ If you feel you must use lambdas, they may be used inside of parentheses::
|
||||||
>>> f'{(lambda x: x*2)(3)}'
|
>>> f'{(lambda x: x*2)(3)}'
|
||||||
'6'
|
'6'
|
||||||
|
|
||||||
|
Can't combine with 'u'
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
The 'u' prefix was added to Python 3.3 in PEP 414 as a means to ease
|
||||||
|
source compatibility with Python 2.7. Because Python 2.7 will never
|
||||||
|
support f-strings, there is nothing to be gained by being able to
|
||||||
|
combine the 'f' prefix with 'u'.
|
||||||
|
|
||||||
Examples from Python's source code
|
Examples from Python's source code
|
||||||
==================================
|
==================================
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue