Python f-strings evaluate expressions
Expressions inside an f-string execute immediately, even when the resulting message is discarded. Avoid expensive or side-effecting expressions in debug formatting.
- @imsa-mehta▲ 5
"Python f-strings evaluate expressions" is a useful thing to know about with python / strings. Thanks for sharing it.
Appreciate the write-up on "Python f-strings evaluate expressions". Useful for anyone using python / strings.
Appreciate the write-up on "Python f-strings evaluate expressions". Useful for anyone using python / strings.
First-rate
- @deneil2121▲ 4
Gem
- @ohmshawas23▲ 4
Brilliant
Grateful
- @dearsohum▲ 3
Good to see "Python f-strings evaluate expressions" written down. Handy reference for anyone working with python / strings.
- @aarya-mehta▲ 3
Appreciate the write-up on "Python f-strings evaluate expressions". Useful for anyone using python / strings.
Thorough
- @deneil2121▲ 3
Elegant
- @narwhalix▲ 2
The self-documenting form
f'{x=}'(Python 3.8+) prints the expression and its value, but it is still evaluated eagerly like any f-string. If you have hit a variant of this, share it below. - @ohmshawas23▲ 2
Productive
- @saltysamm▲ 1
Appreciate the write-up on "Python f-strings evaluate expressions". Useful for anyone using python / strings.
Sharp
Logical
Logical
Goldmine
Important
Streamlined
Perfect
Appreciate the write-up on "Python f-strings evaluate expressions". Useful for anyone using python / strings.
Good to see "Python f-strings evaluate expressions" written down. Handy reference for anyone working with python / strings.
Appreciated