2021-08-12 15:44:08 +00:00
|
|
|
"""
|
|
|
|
categories: Core
|
2021-11-18 12:29:48 +00:00
|
|
|
description: f-strings don't support concatenation with adjacent literals if the adjacent literals contain braces or are f-strings
|
2021-08-12 15:44:08 +00:00
|
|
|
cause: MicroPython is optimised for code space.
|
2021-11-18 12:29:48 +00:00
|
|
|
workaround: Use the + operator between literal strings when either or both are f-strings
|
2021-08-12 15:44:08 +00:00
|
|
|
"""
|
|
|
|
|
2021-11-18 12:29:48 +00:00
|
|
|
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
|
|
|
|
print(f"{x}" f"{y}") # fails
|