I stumbled across this on Reddit earlier and thought it worth sharing here too.
Python 3.8 has enhanced f-string so you can now have self-documenting expressions. Why does this matter? Well if you are printing outputs to debug problems, (as Zed constantly reminds us to do…) then this can be very helpful…
Printing variables
name = "Paul"
age = 25
print(name)
print(age)
Output
Paul
25
Printing variables with f-strings
print(f"Name is {name}")
print(f"Age is {age}")
Output
Name is Paul
Age is 25
3.8 f-string enhancements
print(f"{name=}")
print(f"{age=}")
Output
name='Paul'
age=25