4 ms·
Not a fan. We already have 2 ways of formating strings in Python, we really should not bring in a third one. It may be true that "{} {}".format(a, b) is
by sauere 11y ago
Not a fan. We already have 2 ways of formating strings in Python, we really should not bring in a third one.
It may be true that
"{} {}".format(a, b)
is a bit verbose, but it is crystal clear and clean. Just remember the Python Zen: "There should be one-- and preferably only one --obvious way to do it." _and_ "Explicit is better than implicit."
- mixmastamyk 11y agoIt is the same thing as .format without all the noise.
- Grue3 11y agoNo, it's the same thing as .format, except limited to literals, so basically useless (hardcoding literal strings is bad for i10n).
- mixmastamyk 11y agoUseless... have you never used a shell? It's quite handy.
- Grue3 11y agoIf they're adding features purely for the convenience of python shell users, how about, I don't know, remove the need for significant whitespace (by adding "end block" statement). Because Python shell is a major pain to use when you try to copy-paste some code into it and it doesn't like the indentation levels. On the other hand I can copy-paste whatever into my Lisp REPL and it will run just fine. Or allow several statements per lambda. Saving a few keystrokes writing ".format" doesn't even register on the same scale of annoyance.
- mixmastamyk 11y agoI've been using Python heavily since about 2000. Approximately 2.5 times since then has whitespace been a problem, and which I fixed in under 10 seconds each time. Yet, the readability gains from removal of block delimiters in that time frame is uncountable. > Saving a few keystrokes writing ".format" doesn't even register on the same scale of annoyance It isn't just .format, it is: .format(long_variable_name1=long_variable_name1, long_variable_name2=long_variable_name2) This is a huge win that should have happened long ago.
- Grue3 11y agoBut you don't need to use long variable names in Python shell! Even one-letter vars are perfectly acceptable.
- mixmastamyk 11y agoWhen I wrote "shell" I was thinking of interpolation of bash, etc.