mirror of
https://github.com/W3SLAV/micropython.git
synced 2025-06-19 20:15:33 -04:00

This is quite a simple and small change to support concatenation of adjacent f-strings, and improve compatibility with CPython. Signed-off-by: Damien George <damien@micropython.org>
13 lines
404 B
Python
13 lines
404 B
Python
"""
|
|
categories: Core
|
|
description: f-strings don't support concatenation with adjacent literals if the adjacent literals contain braces
|
|
cause: MicroPython is optimised for code space.
|
|
workaround: Use the + operator between literal strings when they are not both f-strings
|
|
"""
|
|
|
|
x, y = 1, 2
|
|
print("aa" f"{x}") # works
|
|
print(f"{x}" "ab") # works
|
|
print("a{}a" f"{x}") # fails
|
|
print(f"{x}" "a{}b") # fails
|