Remix.run Logo
layer8 an hour ago

It’s unclear what the big advantage is over `print("Age: "+age)`. It’s even more characters, in that specific example.

mixmastamyk an hour ago | parent | next [-]

Toy examples aren’t the use case, rather multiple variables or expressions, perhaps with formatting (padding) as well.

f-string is shorter, less err prone, and faster for medium complexity or above.

an hour ago | parent | prev | next [-]
[deleted]
kstrauser an hour ago | parent | prev [-]

If age is a number, that won’t work.

layer8 an hour ago | parent [-]

Admittedly I’m not so familiar with Python; it does work in Java. In that case, introducing a less hazardous string concatenation operator would seem more universally useful.

kstrauser an hour ago | parent [-]

In Python, that less hazardous string concatenation operator is an f-string.

layer8 22 minutes ago | parent [-]

I’m assuming you can only use it with string literals, hence it is less universally useful.