Skip to content

Commit fff524e

Browse files
[3.12] Add version directives to ast docs (GH-108788) (#109106)
Add version directives to ast docs (GH-108788) (cherry picked from commit 74fc96b) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
1 parent 68ba35e commit fff524e

File tree

1 file changed

+42
-4
lines changed

1 file changed

+42
-4
lines changed

Doc/library/ast.rst

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -650,10 +650,10 @@ Expressions
650650

651651
.. class:: NamedExpr(target, value)
652652

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.
657657

658658
.. doctest::
659659

@@ -663,6 +663,7 @@ Expressions
663663
target=Name(id='x', ctx=Store()),
664664
value=Constant(value=4)))
665665

666+
.. versionadded:: 3.8
666667

667668
Subscripting
668669
~~~~~~~~~~~~
@@ -1036,6 +1037,7 @@ Statements
10361037
value=Name(id='int', ctx=Load()))],
10371038
type_ignores=[])
10381039

1040+
.. versionadded:: 3.12
10391041

10401042
Other statements which are only applicable inside functions or loops are
10411043
described in other sections.
@@ -1318,6 +1320,7 @@ Control flow
13181320
finalbody=[])],
13191321
type_ignores=[])
13201322

1323+
.. versionadded:: 3.11
13211324

13221325
.. class:: ExceptHandler(type, name, body)
13231326

@@ -1407,6 +1410,8 @@ Pattern matching
14071410
that is being matched against the cases) and ``cases`` contains an iterable of
14081411
:class:`match_case` nodes with the different cases.
14091412

1413+
.. versionadded:: 3.10
1414+
14101415
.. class:: match_case(pattern, guard, body)
14111416

14121417
A single case pattern in a ``match`` statement. ``pattern`` contains the
@@ -1458,6 +1463,8 @@ Pattern matching
14581463
value=Constant(value=Ellipsis))])])],
14591464
type_ignores=[])
14601465

1466+
.. versionadded:: 3.10
1467+
14611468
.. class:: MatchValue(value)
14621469

14631470
A match literal or value pattern that compares by equality. ``value`` is
@@ -1485,6 +1492,8 @@ Pattern matching
14851492
value=Constant(value=Ellipsis))])])],
14861493
type_ignores=[])
14871494

1495+
.. versionadded:: 3.10
1496+
14881497
.. class:: MatchSingleton(value)
14891498

14901499
A match literal pattern that compares by identity. ``value`` is the
@@ -1510,6 +1519,8 @@ Pattern matching
15101519
value=Constant(value=Ellipsis))])])],
15111520
type_ignores=[])
15121521

1522+
.. versionadded:: 3.10
1523+
15131524
.. class:: MatchSequence(patterns)
15141525

15151526
A match sequence pattern. ``patterns`` contains the patterns to be matched
@@ -1541,6 +1552,8 @@ Pattern matching
15411552
value=Constant(value=Ellipsis))])])],
15421553
type_ignores=[])
15431554

1555+
.. versionadded:: 3.10
1556+
15441557
.. class:: MatchStar(name)
15451558

15461559
Matches the rest of the sequence in a variable length match sequence pattern.
@@ -1581,6 +1594,8 @@ Pattern matching
15811594
value=Constant(value=Ellipsis))])])],
15821595
type_ignores=[])
15831596

1597+
.. versionadded:: 3.10
1598+
15841599
.. class:: MatchMapping(keys, patterns, rest)
15851600

15861601
A match mapping pattern. ``keys`` is a sequence of expression nodes.
@@ -1627,6 +1642,8 @@ Pattern matching
16271642
value=Constant(value=Ellipsis))])])],
16281643
type_ignores=[])
16291644

1645+
.. versionadded:: 3.10
1646+
16301647
.. class:: MatchClass(cls, patterns, kwd_attrs, kwd_patterns)
16311648

16321649
A match class pattern. ``cls`` is an expression giving the nominal class to
@@ -1691,6 +1708,8 @@ Pattern matching
16911708
value=Constant(value=Ellipsis))])])],
16921709
type_ignores=[])
16931710

1711+
.. versionadded:: 3.10
1712+
16941713
.. class:: MatchAs(pattern, name)
16951714

16961715
A match "as-pattern", capture pattern or wildcard pattern. ``pattern``
@@ -1732,6 +1751,8 @@ Pattern matching
17321751
value=Constant(value=Ellipsis))])])],
17331752
type_ignores=[])
17341753

1754+
.. versionadded:: 3.10
1755+
17351756
.. class:: MatchOr(patterns)
17361757

17371758
A match "or-pattern". An or-pattern matches each of its subpatterns in turn
@@ -1764,6 +1785,8 @@ Pattern matching
17641785
value=Constant(value=Ellipsis))])])],
17651786
type_ignores=[])
17661787

1788+
.. versionadded:: 3.10
1789+
17671790
.. _ast-type-params:
17681791

17691792
Type parameters
@@ -1795,6 +1818,8 @@ aliases.
17951818
ctx=Load()))],
17961819
type_ignores=[])
17971820

1821+
.. versionadded:: 3.12
1822+
17981823
.. class:: ParamSpec(name)
17991824

18001825
A :class:`typing.ParamSpec`. ``name`` is the name of the parameter specification.
@@ -1818,6 +1843,8 @@ aliases.
18181843
ctx=Load()))],
18191844
type_ignores=[])
18201845

1846+
.. versionadded:: 3.12
1847+
18211848
.. class:: TypeVarTuple(name)
18221849

18231850
A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable tuple.
@@ -1842,6 +1869,8 @@ aliases.
18421869
ctx=Load()))],
18431870
type_ignores=[])
18441871

1872+
.. versionadded:: 3.12
1873+
18451874
Function and class definitions
18461875
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18471876

@@ -1861,6 +1890,9 @@ Function and class definitions
18611890

18621891
``type_comment`` is an optional string with the type annotation as a comment.
18631892

1893+
.. versionchanged:: 3.12
1894+
Added ``type_params``.
1895+
18641896

18651897
.. class:: Lambda(args, body)
18661898

@@ -2059,6 +2091,9 @@ Function and class definitions
20592091
type_params=[])],
20602092
type_ignores=[])
20612093

2094+
.. versionchanged:: 3.12
2095+
Added ``type_params``.
2096+
20622097
Async and await
20632098
^^^^^^^^^^^^^^^
20642099

@@ -2067,6 +2102,9 @@ Async and await
20672102
An ``async def`` function definition. Has the same fields as
20682103
:class:`FunctionDef`.
20692104

2105+
.. versionchanged:: 3.12
2106+
Added ``type_params``.
2107+
20702108

20712109
.. class:: Await(value)
20722110

0 commit comments

Comments
 (0)