News for hackers. Stuff that matters.
Re:New string formatting in Python by mixmastamyk on Sunday January 03, 2016 @08:58PM (#10833617)
It is explicit, in that one must use the f'' prefix. There are no syntax changes as u'', b'', and r'' already exist. Positionals make bugs more likely.
Re:New string formatting in Python by schmichael on Sunday January 03, 2016 @09:01PM (#10833628)
It is implicit in that the interpolated values are specified anywhere in scope, not inline as with every other formatting option.

I consider specifying the values or variables alongside the formatting string a requirement to be considered explicit, but I can see how it's a matter of opinion.

Re:New string formatting in Python by sametmax on Monday January 04, 2016 @02:45AM (#10834448)

    @decorator
    def decorated
Is doing:

    decorated = decorator(decorated)
The switch is implicit too. It's syntaxic sugar to gain a pratical and elegant syntax for a common use case.

It's not going to introduce vulnerability. It's going to make your code easier to write and read. It's going to make bug easier to spot in formating. It's going to make shell sessions easier.

Re:New string formatting in Python by schmichael on Monday January 04, 2016 @02:43PM (#10837965)
The manipulation (@dec) is still right next to the thing being manipulated (def dec).

I'm not trying to be pedantic. It really does affect readability when syntactic sugar's affect spans an entire scope. Whether or not that effect on readability is greater or less than the gain by the syntactic sugar is always a matter of opinion. Obviously my opinion is out of line with Python's core devs.

Re:New string formatting in Python by schmichael on Sunday January 03, 2016 @09:02PM (#10833634)
It is a syntax change as before f"" was a syntax error:

    >>> f"foo"
      File "<stdin>", line 1
        f"foo"
             ^
    SyntaxError: invalid syntax
Re:New string formatting in Python by schmichael on Sunday January 03, 2016 @09:23PM (#10833693)
> ... though similar to adding a function that didn't exist before.

This is not true and exactly the distinction I'm trying to make:

Adding new packages, functions, objects, etc. can all be backported to older versions and alternative implementations. They also require no updates to ASTs, linters, syntax highlighters, static analysis tools etc.

Adding new syntax is backward incompatible (unless it's added as a from __future__ import to new old releases) and requires changes to all tools that parse Python syntax (the interpreter, ASTs, linters, transpilers, etc).

Re:New string formatting in Python by mixmastamyk on Sunday January 03, 2016 @10:52PM (#10833902)
Ok, true, though I would argue that it isn't entirely new syntax but rather a variation of an existing one.

It is a shame that linters will have to add a letter to their grammar also, but I argue that the everyday usability and readability for millions will outweigh this drawback.

Re:New string formatting in Python by mixmastamyk on Sunday January 03, 2016 @09:14PM (#10833666)
I suppose technically true, though similar to adding a function that didn't exist before. The syntax extension part of the feature (adding a letter to the grammar) is minuscule.