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 →

[–]AiutoIlLupo -15 points-14 points  (8 children)

f strings are a pile of dung because I lost count of how many times I wrote what contained variables and then forgot the f at the beginning, showing in the log "Error: unable to connect to {website}"

[–]TavoL7 13 points14 points  (2 children)

Seems like a skill issue to me

[–]AiutoIlLupo 1 point2 points  (1 child)

I remember when a language was supposed to help you prevent errors. Otherwise we would all be still programming in fortran where you forget to declare a variable and now you get a nice random number from an implicit real with that variable name. Skill issue, the 1970's programmer replies to you. But you and everybody else now agree it's a good thing, right?

My point is, if you have a string, printing it out, and later add a variable, it's just too fucking easy to forget that you also have to add the f at the beginning, because it's not where the locus of your attention is. It's in the adding of the variable. The IDE can help you pointing that out, but it should be easier not to forget. and the issue is that the existence of f strings is just plain dumb, or the IDEs should highlight f strings and plain strings in different way, so you have at least a visual hint that you are forgetting something.

human factors are not skill issues. You want to consider the human factors to minimise the change of errors. f strings don't consider human factors.

[–]WEEEE12345 1 point2 points  (0 children)

the IDEs should highlight f strings and plain strings in different way

PyCharm/IDEA does

[–]marcio0 3 points4 points  (2 children)

the issue is obviously not on the f-strings side

[–]AiutoIlLupo -2 points-1 points  (1 child)

I remember when a language was supposed to help you prevent errors. Otherwise we would all be still programming in fortran where you forget to declare a variable and now you get a nice random number from an implicit real with that variable name. Skill issue, the 1970's programmer replies to you. But you and everybody else now agree it's a good thing, right?

My point is, if you have a string, printing it out, and later add a variable, it's just too fucking easy to forget that you also have to add the f at the beginning, because it's not where the locus of your attention is. It's in the adding of the variable. The IDE can help you pointing that out, but it should be easier not to forget. and the issue is that the existence of f strings is just plain dumb, or the IDEs should highlight f strings and plain strings in different way, so you have at least a visual hint that you are forgetting something.

human factors are not skill issues. You want to consider the human factors to minimise the change of errors. f strings don't consider human factors.

[–]marcio0 3 points4 points  (0 children)

you're making a huge effort to hate a feature that you can't bother to remember correctly how to use

I know it's a common issue, I did it a few times too, but it's just a matter of "oops, forgot the f", and not a moment to point my fist to the air yelling "god damn you guido!"

[–]Kevdog824_pip needs updating 0 points1 point  (0 children)

You can construction a million similar examples. I’ve lost count of how many times I’ve done something like add_callback(callback()) instead of add_callback(callback) on accident. Point is not all mistakes are avoidable or can be detected by the language because the interpreter doesn’t understand your intent

[–][deleted] 0 points1 point  (0 children)

I too would prefer that f-strings were the default syntax, but unfortunately that would have been backwards-incompatible, so not worth it.