@@ -650,10 +650,10 @@ Expressions
650
650
651
651
.. class :: NamedExpr(target, value)
652
652
653
- A named expression. This AST node is produced by the assignment expressions
654
- operator (also known as the walrus operator). As opposed to the :class: `Assign `
655
- node in which the first argument can be multiple nodes, in this case both
656
- ``target `` and ``value `` must be single nodes.
653
+ A named expression. This AST node is produced by the assignment expressions
654
+ operator (also known as the walrus operator). As opposed to the :class: `Assign `
655
+ node in which the first argument can be multiple nodes, in this case both
656
+ ``target `` and ``value `` must be single nodes.
657
657
658
658
.. doctest ::
659
659
@@ -663,6 +663,7 @@ Expressions
663
663
target=Name(id='x', ctx=Store()),
664
664
value=Constant(value=4)))
665
665
666
+ .. versionadded :: 3.8
666
667
667
668
Subscripting
668
669
~~~~~~~~~~~~
@@ -1036,6 +1037,7 @@ Statements
1036
1037
value=Name(id='int', ctx=Load()))],
1037
1038
type_ignores=[])
1038
1039
1040
+ .. versionadded :: 3.12
1039
1041
1040
1042
Other statements which are only applicable inside functions or loops are
1041
1043
described in other sections.
@@ -1318,6 +1320,7 @@ Control flow
1318
1320
finalbody=[])],
1319
1321
type_ignores=[])
1320
1322
1323
+ .. versionadded :: 3.11
1321
1324
1322
1325
.. class :: ExceptHandler(type, name, body)
1323
1326
@@ -1407,6 +1410,8 @@ Pattern matching
1407
1410
that is being matched against the cases) and ``cases `` contains an iterable of
1408
1411
:class: `match_case ` nodes with the different cases.
1409
1412
1413
+ .. versionadded :: 3.10
1414
+
1410
1415
.. class :: match_case(pattern, guard, body)
1411
1416
1412
1417
A single case pattern in a ``match `` statement. ``pattern `` contains the
@@ -1458,6 +1463,8 @@ Pattern matching
1458
1463
value=Constant(value=Ellipsis))])])],
1459
1464
type_ignores=[])
1460
1465
1466
+ .. versionadded :: 3.10
1467
+
1461
1468
.. class :: MatchValue(value)
1462
1469
1463
1470
A match literal or value pattern that compares by equality. ``value `` is
@@ -1485,6 +1492,8 @@ Pattern matching
1485
1492
value=Constant(value=Ellipsis))])])],
1486
1493
type_ignores=[])
1487
1494
1495
+ .. versionadded :: 3.10
1496
+
1488
1497
.. class :: MatchSingleton(value)
1489
1498
1490
1499
A match literal pattern that compares by identity. ``value `` is the
@@ -1510,6 +1519,8 @@ Pattern matching
1510
1519
value=Constant(value=Ellipsis))])])],
1511
1520
type_ignores=[])
1512
1521
1522
+ .. versionadded :: 3.10
1523
+
1513
1524
.. class :: MatchSequence(patterns)
1514
1525
1515
1526
A match sequence pattern. ``patterns `` contains the patterns to be matched
@@ -1541,6 +1552,8 @@ Pattern matching
1541
1552
value=Constant(value=Ellipsis))])])],
1542
1553
type_ignores=[])
1543
1554
1555
+ .. versionadded :: 3.10
1556
+
1544
1557
.. class :: MatchStar(name)
1545
1558
1546
1559
Matches the rest of the sequence in a variable length match sequence pattern.
@@ -1581,6 +1594,8 @@ Pattern matching
1581
1594
value=Constant(value=Ellipsis))])])],
1582
1595
type_ignores=[])
1583
1596
1597
+ .. versionadded :: 3.10
1598
+
1584
1599
.. class :: MatchMapping(keys, patterns, rest)
1585
1600
1586
1601
A match mapping pattern. ``keys `` is a sequence of expression nodes.
@@ -1627,6 +1642,8 @@ Pattern matching
1627
1642
value=Constant(value=Ellipsis))])])],
1628
1643
type_ignores=[])
1629
1644
1645
+ .. versionadded :: 3.10
1646
+
1630
1647
.. class :: MatchClass(cls, patterns, kwd_attrs, kwd_patterns)
1631
1648
1632
1649
A match class pattern. ``cls `` is an expression giving the nominal class to
@@ -1691,6 +1708,8 @@ Pattern matching
1691
1708
value=Constant(value=Ellipsis))])])],
1692
1709
type_ignores=[])
1693
1710
1711
+ .. versionadded :: 3.10
1712
+
1694
1713
.. class :: MatchAs(pattern, name)
1695
1714
1696
1715
A match "as-pattern", capture pattern or wildcard pattern. ``pattern ``
@@ -1732,6 +1751,8 @@ Pattern matching
1732
1751
value=Constant(value=Ellipsis))])])],
1733
1752
type_ignores=[])
1734
1753
1754
+ .. versionadded :: 3.10
1755
+
1735
1756
.. class :: MatchOr(patterns)
1736
1757
1737
1758
A match "or-pattern". An or-pattern matches each of its subpatterns in turn
@@ -1764,6 +1785,8 @@ Pattern matching
1764
1785
value=Constant(value=Ellipsis))])])],
1765
1786
type_ignores=[])
1766
1787
1788
+ .. versionadded :: 3.10
1789
+
1767
1790
.. _ast-type-params :
1768
1791
1769
1792
Type parameters
@@ -1795,6 +1818,8 @@ aliases.
1795
1818
ctx=Load()))],
1796
1819
type_ignores=[])
1797
1820
1821
+ .. versionadded :: 3.12
1822
+
1798
1823
.. class :: ParamSpec(name)
1799
1824
1800
1825
A :class: `typing.ParamSpec `. ``name `` is the name of the parameter specification.
@@ -1818,6 +1843,8 @@ aliases.
1818
1843
ctx=Load()))],
1819
1844
type_ignores=[])
1820
1845
1846
+ .. versionadded :: 3.12
1847
+
1821
1848
.. class :: TypeVarTuple(name)
1822
1849
1823
1850
A :class: `typing.TypeVarTuple `. ``name `` is the name of the type variable tuple.
@@ -1842,6 +1869,8 @@ aliases.
1842
1869
ctx=Load()))],
1843
1870
type_ignores=[])
1844
1871
1872
+ .. versionadded :: 3.12
1873
+
1845
1874
Function and class definitions
1846
1875
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1847
1876
@@ -1861,6 +1890,9 @@ Function and class definitions
1861
1890
1862
1891
``type_comment `` is an optional string with the type annotation as a comment.
1863
1892
1893
+ .. versionchanged :: 3.12
1894
+ Added ``type_params ``.
1895
+
1864
1896
1865
1897
.. class :: Lambda(args, body)
1866
1898
@@ -2059,6 +2091,9 @@ Function and class definitions
2059
2091
type_params=[])],
2060
2092
type_ignores=[])
2061
2093
2094
+ .. versionchanged :: 3.12
2095
+ Added ``type_params ``.
2096
+
2062
2097
Async and await
2063
2098
^^^^^^^^^^^^^^^
2064
2099
@@ -2067,6 +2102,9 @@ Async and await
2067
2102
An ``async def `` function definition. Has the same fields as
2068
2103
:class: `FunctionDef `.
2069
2104
2105
+ .. versionchanged :: 3.12
2106
+ Added ``type_params ``.
2107
+
2070
2108
2071
2109
.. class :: Await(value)
2072
2110
0 commit comments