Python 3.12 Preview: More Intuitive and Consistent F-Strings

Every new Python version brings many changes, updates, fixes, and new features. Python 3.12 will be the next minor version and is now in the beta phase. In this version, the core team has been working intensely to formalize and improve the syntax and behavior of one of the most popular Python features: f-strings.

F-strings, short for formatted strings, are string literals prefixed by either a lowercase or uppercase letter F. These strings provide a concise and clean syntax that allows the interpolation of variables and expressions.

In this tutorial, you’ll learn about:

  • Limitations of f-strings in Python versions before 3.12
  • Advantages of formalizing the f-string syntax
  • New capabilities and features of f-strings in Python 3.12
  • Formalization as

     

     

     

    To finish reading, please visit source site