News for hackers. Stuff that matters.
Re:New string formatting in Python by mixmastamyk on Sunday January 03, 2016 @08:13PM (#10833490)
I'm a bit confused about all the doubt on such a common feature industry wide. No, it's not magic, it's a simple transformation, takes about 30 seconds to learn, and is becoming an industry standard among modern languages. See C#, Scala, JS, Swift, etc, not to mention bash and perl.

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.

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.

Re:New string formatting in Python by pcwalton on Sunday January 03, 2016 @10:12PM (#10833823)
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.