Skip to content

Information about how the python grammar has changed over time

License

Notifications You must be signed in to change notification settings

thatch/python-grammar-changes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

11 Commits

Repository files navigation

Here's a high-level log of grammar changes by version, with the most effort sppent analyzing 3.6 and before. (The release listed is from tags on master, and probably doesn't take into account backports where the commit id is different.)

ReleaseCommitFeatureWith __future__
v3.11.0d60457a6PEP 654 except* groups
v3.11.0e8e737bcPEP 646 variadic generics
v3.10.0145bf269PEP 622/634 match statements
v3.9.00daba822parenthesized context manager change
v3.8.0b5e3ea28 + a965db37PEP 570 positional-only params
v3.8.08f59ee01PEP 572 :=
v3.7.0--annotations (on in 4.0)
v3.7.0ac317700PEP 492 async/await become keywords
v3.6.0a721abacPEP 515 underscores in numeric literals
v3.6.052c4e7ccPEP 530 async for comprehensions
v3.6.0f8cb8a16 (2016)PEP 526 foo: int annotations
v3.6.0*235a6f09PEP 498 f-strings
v3.6.0*df395991def f(a,) trailing commas
v3.5.0--generator_stop (on in 3.7)
v3.5.014acf5f4f(*a if b else c) fix
v3.5.0de12b79cf(**a if b else c) fix
v3.5.07544508fPEP 492 async def, for, with
v3.5.0025e9ebdPEP 448 {**x} ??
v3.5.0d51374ed (2014)PEP 465 a @ b and a @= b matrix multiply
v3.3.0*1f7ce62bPEP 380 yield from
v3.3.0*6ecf77b3PEP 414 u-prefix strings are back
3.1*1c50d117 (2010)refactor argslist, a no-op?
3.1*4905e80cFix ambiguity in unpacking
3.1*0c31562awith can have multiple
3.1*e3944a5ePEP 401 <> operatorbarry_as_FLUFL
v3.0*2d735bc0Allow keywords after *args
v3.0*828f04ac3-arg raise becomes raise ... from
v3.0*992d4a3ePEP 274 {k: v for ... } dict comprehensions
v3.0*e7ba4956True, False, None are now keywords
v3.0*d59da4b4class decorators
v3.0*1bc535dcNo tuple unpacking in args
v3.0*0368b726extended iterable unpacking
v3.0*650f0d06lambda/for ambiguity removal
v3.0*e66c8c7cbugfix from ... import (with 3 .)
v3.0*dde00289 (2007)... is a token
v3.0*52cc1d83Metaclass changeover
v3.0*81e9502dnonlocal x
v3.0*452bf519print statement removal
v3.0*b940e113 + 16be03e4except ... as x
v3.0*c150536bPEP 3107 py3 type hints
v3.0*4f72a786 (2006)PEP 3102 kwonly args
v3.0*52318d62... is a token
v3.0*7cae87caexec statement removal
v3.0*86e58e23set literals
v3.0*cf588f64backticks removal
v3.0*b053cd8f<> operator removal
v3.0*477c8d5efrom .. for parent relative imports
v3.0*49fd7fa4 (2006)change to if-conditions I don't understand
v2.7*45aecf45as and with become keywords
v2.6--print_function (on in 3)
v2.6--unicode_literals (on in 3)
v2.58ae1295cas and with are optionally keywords
v2.5f7f438baPEP 328 relative/absolute importsabsolute_import (on in 3)
v2.5c2e20744with statementswith_statement (on in 2.6)
v2.5dca3b9c7 + d074beb6lambda/for ambiguity
v2.5f599f424PEP 341 try/except and try/finally unification
v2.537c0844b (2005)require parens on kwarg generators
v2.50d6615fdPEP 342 adds yield expr
v2.5409d8f2eclass F() ok now
v2.41a4ddaecmulti-line import tuple
v2.40ccff074Require newlines between decorators
v2.4c2a5a636PEP 318 (decorators)
v2.4354433a5PEP 289 (generator expressions)
v2.300f1e3f5PEP 263 (source encoding)
v2.32d3b9864change to backtick that ends with comma
v2.384ee323c (2002)disambiguate power-of-power
v2.21c917072 (2001)ban a list comprehension trailing comma
v2.24668b000// for floordivdivision (on in 3)
v2.25ca576edyield statementgenerators (on in 2.3)
v2.1--nested_scopes (on in 2.2)
v2.0434d0828**= and friends
v2.046dfa5f4[1 if x] is not a list comprehension
v2.00360663e (2000)print >>file, x and trailing comma
v2.0803d6e54list comprehensions
v2.07690151c"extended call syntax" f(*args, **kwargs)
v2.0d295f120no-args raise
v2.003a7466b + 556440d2assert statement
v2.00dfcf753access statement removal
v2.014f44516slice syntax changes
v2.00bfd6c33add power operator
v2.0a996b9103-arg raise, and more
v2.04a1da268import a.b
v2.0248a50c1implicit concatenation, try/except/else, default values in args
v2.057531fea + 590baa4a + 12d12c5flambdas
v2.0db3165e6add exec statement
v2.0b3f7258f + 25831652access statement addition, something about class header
v2.002334d2bvarargs uses *
v2.0af82141blooks like try/except/finally becomes try/except and try/finally
v2.0e785fbcfallow newline at end of eval
v2.0610cdc52varargs uses * or +
v2.0526e9096varargs uses +
v2.009cea474 + 6cf1273fevidently = used to work for comparison
v2.068fc3497global statement, "new" class syntax with bases in parens
v2.09eb4f535 + a76fb5b6lots of operators
v2.056f78377semicolons, continue, dict literals, and more
v2.04dae2167remove dir statement?
v2.085a5fbbdinitial commit in current location

* These commits are present in old tags according to git, but the released binaries do not appear to recognize them.

Code samples

These are found in the examples/ directory listed by the version they are "first" added. Some are backported. This could be cleaned up, and entries removed from this README if someone is interested and has time.

If you get python 2.3 through 3.8 installed on your PATH, you can check an installed LibCST against the changes that result in syntax errors.

$ python metarun.py 23 24 25 26 27 30 31 32 33 34 35 36 37 38 examples/py24-0027-generator-expr.py X o o o o o o o o o o o o o examples/py26-0025-print-function1.py O O o O O . . . . . . . . . examples/py26-0025-print-function2.py X X . X X o o o o o o o o o examples/py26-0025-print-function3.py X X . o o o o o o o o o o o ... 

About

Information about how the python grammar has changed over time

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages