Template Strings (f-strings) Improvements in Python 3.15 2026
Python 3.15 brings several enhancements to f-strings including better support for nested expressions, improved debugging with = specifier, and new formatting options. These changes make f-strings even more powerful and expressive in 2026.
TL;DR — Key f-string Improvements
- Deeper nesting support
- Enhanced = debug specifier
- New formatting specifiers
- Better error messages for malformed f-strings
Example
name = "Alice"
value = 42
print(f"{name=} {value=:.2f} {value * 2 = }")
# Output: name='Alice' value=42.00 value * 2 = 84
Best Practices 2026
- Use = specifier for quick debugging
- Prefer f-strings over .format() and % formatting
- Combine with walrus operator for complex expressions
Conclusion
f-strings continue to evolve and remain the preferred way to format strings in modern Python.