[Python-checkins] peps: Added a note about concatenating adjacent f-strings.

eric.smith python-checkins at python.org
Sat Sep 12 12:55:37 CEST 2015


https://hg.python.org/peps/rev/eecc65fd0c06
changeset:   6049:eecc65fd0c06
user:        Eric V. Smith <eric at trueblade.com>
date:        Sat Sep 12 06:55:44 2015 -0400
summary:
  Added a note about concatenating adjacent f-strings.

files:
  pep-0498.txt |  8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)


diff --git a/pep-0498.txt b/pep-0498.txt
--- a/pep-0498.txt
+++ b/pep-0498.txt
@@ -374,6 +374,14 @@
 
   'ab' + x.__format__('') + '{c}' + 'str<' + y.__format__('^4') + '>de'
 
+Each f-string is entirely evaluated before being concatenated to
+adjacent f-strings. That means that this::
+
+  >>> f'{x' f'}'
+
+Is a syntax error, because the first f-string does not contain a
+closing brace.
+
 Error handling
 --------------
 

-- 
Repository URL: https://hg.python.org/peps


More information about the Python-checkins mailing list