2 ms·
I guess you are a big fan of f-strings too :D While I see the point of them in their terseness, I am not a big fan because they blur the line between strings a
by necovek 5y ago
I guess you are a big fan of f-strings too :D
While I see the point of them in their terseness, I am not a big fan because they blur the line between strings and code (eg. mark the f-string as translatable, and suddenly translators can easily introduce security bugs and expose sensitive data from locals()).
The idea of fn"" strings have all the same bad properties, but are even worse: you want people to start programming in strings vs. in keywords, and for what gain? IDEs will have a harder time syntax correcting, and it'll be easier to make mistakes (do you allow meta-programming fn-strings?)
It does not help your case that your example can already be achieved in Python with `if n2 < n1 < n3:` (or `if n1 < n2: print "underflow"...). But even then, it seems you are disliking the regular function syntax and would prefer an option to move to more infix operators (many of which can be redefined in Python, but people don't do it too much because it's confusing if the semantics are not obvious to the reader).
Can you come up with an example where using strings is more readable and less confusing than regular syntax?