Re:New string formatting in Python
by schmichael on Sunday January 03, 2016 @08:53PM
(#10833604)
All of the languages you list have been criticized for adding too many language features.
Go and Rust are two notable new languages which require explicit formatting functions as opposed to relying on special string interpolation syntax.
Well, Rust formatting is magical, unlike that of Go: it has to be because it has type-safe format strings, which can't be expressed in the normal language. But the magic is encapsulated into a macro, so the complexity doesn't leak into the language per se. Someone could write a similar string interpolation macro and replicate Python's feature without modifying the compiler if they wanted--though the fact that nobody has so far indicates to me that it probably isn't needed, as the {} syntax is awfully lightweight already.
Re:New string formatting in Python
by mixmastamyk on Sunday January 03, 2016 @09:04PM
(#10833642)
Interpolation is one of the features I require in a rapid prototyping language, it is useful every single day and not esoteric.
Re:New string formatting in Python
by schmichael on Sunday January 03, 2016 @10:48PM
(#10833896)
Python was and still is to some diminishing degree influenced by C, C++, and Java - none of which have language syntax for interpolating strings based on variables in scope.
Re:New string formatting in Python
by icebraining on Monday January 04, 2016 @05:41AM
(#10834825)
I wouldn't say it was influenced by Java, seeing as all the core syntax (functions, classes, modules, etc) was already present when Java was first released publicly. The stuff added later doesn't come from it either (list comprehensions, generators, etc).
Re:New string formatting in Python
by mixmastamyk on Sunday January 03, 2016 @11:04PM
(#10833930)
Yes, though it has more in common with Perl and Ruby, which do.
It also has little in common with i18n, the use cases differ too much. Perhaps in the future someone can figure out how to bring them together, but not today.