5 ms·
It is a syntax change as before f"" was a syntax error: >>> f"foo" File "<stdin>", line 1 f"foo" ^ SyntaxError: invalid synt
by schmichael 11y ago
It is a syntax change as before f"" was a syntax error:
>>> f"foo"
File "<stdin>", line 1
f"foo"
^
SyntaxError: invalid syntax
- mixmastamyk 11y agoI 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.
- schmichael 11y ago> ... 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).
- mixmastamyk 11y agoOk, 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.