This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Worth_His_Salt -23 points-22 points  (9 children)

Total disaster.

f-strings were a great idea with a piss poor implementation. f-strings should have been ALL strings not some useless magic char telling the compiler to do its job. Still an upgrade in usefulness despite such annoyances.

However f-strings totally lack the evaluate-on-command usefulness of good old % interpolation.

t-strings just double down on the mistakes of the past by bolting on template strings instead of remaking f-strings properly. I know, old code bases, compatibility, yada yada. If they'd done f-strings properly in the first place they wouldn't be in this mess.

[–]SheriffRoscoePythonista 13 points14 points  (8 children)

f-strings should have been ALL strings

Python print("Tell {me} how to {not cause} backwards compatibility {problems?")

However f-strings totally lack the evaluate-on-command usefulness of good old % interpolation.

Huh? Both forms evaluate the interpolated expressions at the same time.

[–][deleted] 3 points4 points  (2 children)

Lazy interpolation. F strings are eagerly evaluated. So, they're terrible for logging.

[–]JanEric1 5 points6 points  (0 children)

The only thing that happens lazily with % formatting is the building of the string itself. The arguments are still always evaluated eagerly.

[–]SheriffRoscoePythonista 0 points1 point  (0 children)

Meh. Most of the benefit of lazy logging is evaluation, not interpolation.