Re:New string formatting in Python
by mixmastamyk on Sunday January 03, 2016 @08:23PM
(#10833522)
It is the same thing as .format without all the noise.
No, it's the same thing as .format, except limited to literals, so basically useless (hardcoding literal strings is bad for i10n).
Re:New string formatting in Python
by mixmastamyk on Monday January 04, 2016 @12:19PM
(#10836838)
Useless... have you never used a shell? It's quite handy.
If 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.
Re:New string formatting in Python
by mixmastamyk on Wednesday January 06, 2016 @03:11PM
(#10853360)
I'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.But you don't need to use long variable names in Python shell! Even one-letter vars are perfectly acceptable.
Re:New string formatting in Python
by mixmastamyk on Thursday January 07, 2016 @12:53PM
(#10859480)
When I wrote "shell" I was thinking of interpolation of bash, etc.
It may be true that
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."