4 ms·
_log(f”My variable is {x + y}”) Reads to me a lot more fluently to me than _log(“My variable is {}”.format(x+y)) or _log(“My variable is {z}”.forma
by theptip 2y ago
_log(f”My variable is {x + y}”)
Reads to me a lot more fluently to me than
_log(“My variable is {}”.format(x+y))
or
_log(“My variable is {z}”.format(z=x+y))
It’s nothing too profound.
- blami 2y agoI am not very familiar with Python. How do you localize (translate) first one?
- wzdd 2y agoYou don't with f-strings because they're substituted eagerly. You could with the new t-strings proposed here because you can get at the individual parts.
- BiteCode_dev 2y agoThat's what t-strings are about. They are lazy, so you can mark them for translation "as-is".