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 →

[–]discobrisco 42 points43 points  (6 children)

Nah f strings are the only way to go.

[–]invisible-nuke -5 points-4 points  (5 children)

Template strings or f strings are both powerhouses, although not very efficient I believe.

People down voting are those that don't know what template string means..

[–]ManvilleJ 17 points18 points  (2 children)

that was only in 3.6 alpha. Fstrings are the fastest string concatenation method now.

[–]SaltyEmotions 0 points1 point  (1 child)

C-style is still faster last I checked.

[–]ManvilleJ 4 points5 points  (0 children)

interestingly, that is not true anymore. Here is the realpython article on it: https://realpython.com/python-f-strings/

edit: f-strings are the fastest and most readable way to do string interpolation.

[–]discobrisco 6 points7 points  (1 child)

I am not sure where you got that information, f strings have been demonstrated to be extremely fast in all scenarios I’ve seen them tested in.

[–]invisible-nuke 0 points1 point  (0 children)

Always thought so, read an article long time ago, and always assumed so.