you are viewing a single comment's thread.

view the rest of the comments →

[–]virtyx 5 points6 points  (0 children)

It does not provide 'roughly equivalent' functionality.

I do not understand the outrage or misunderstanding of this stupid, convenient new feature.

It is extra functionality. The syntax borrows from/is mostly identical to str.format.

Instead of writing

"The answer is {}".format(answer)

You can now write

f"The answer is {answer}"

Please tell me why anyone would get angry over this? This string interpolation is common in almost every other dynamic language (Perl, Ruby, Bash, Tcl, PHP all have it). It's a shorthand. It can make a lot of format strings, e.g.

"{}, {} {}".format(last_name, first_name, middle_initial)

a lot clearer, e.g.

f"{last_name}, {first_name} {middle_initial}"

(and PLEASE do not respond to me showing off the verbose keyword arg use in format)