8000 bpo-35566: Add links to annotation glossary term (GH-11291) (GH-11302) · python/cpython@bc64123 · GitHub
[go: up one dir, main page]

Skip to content

Commit bc64123

Browse files
miss-islingtonrhettinger
authored andcommitted
bpo-35566: Add links to annotation glossary term (GH-11291) (GH-11302)
1 parent d4f7616 commit bc64123

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

Doc/library/dataclasses.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ Module-level decorators, classes, and functions
5151

5252
The :func:`dataclass` decorator examines the class to find
5353
``field``\s. A ``field`` is defined as class variable that has a
54-
type annotation. With two exceptions described below, nothing in
55-
:func:`dataclass` examines the type specified in the variable
56-
annotation.
54+
:term:`type annotation <variable annotation>`. With two
55+
exceptions described below, nothing in :func:`dataclass`
56+
examines the type specified in the variable annotation.
5757

5858
The order of the fields in all of the generated methods is the
5959
order in which they appear in the class definition.

Doc/reference/compound_stmts.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,8 @@ used keyword arguments.
570570
single: ->; function annotations
571571
single: : (colon); function annotations
572572

573-
Parameters may have annotations of the form "``: expression``" following the
574-
parameter name. Any parameter may have an annotation even those of the form
573+
Parameters may have an :term:`annotation <function annotation>` of the form "``: expression``"
574+
following the parameter name. Any parameter may have an annotation, even those of the form
575575
``*identifier`` or ``**identifier``. Functions may have "return" annotation of
576576
the form "``-> expression``" after the parameter list. These annotations can be
577577
any valid Python expression. The presence of annotations does not change the

Doc/reference/simple_stmts.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ Annotated assignment statements
325325
single: statement; assignment, annotated
326326
single: : (colon); annotated variable
327327

328-
Annotation assignment is the combination, in a single statement,
329-
of a variable or attribute annotation and an optional assignment statement:
328+
:term:`Annotation <variable annotation>` assignment is the combination, in a single
329+
statement, of a variable or attribute annotation and an optional assignment statement:
330330

331331
.. productionlist::
332332
annotated_assignment_stmt: `augtarget` ":" `expression` ["=" `expression`]

Doc/tutorial/controlflow.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,10 @@ Function Annotations
682682
information about the types used by user-defined functions (see :pep:`3107` and
683683
:pep:`484` for more information).
684684

685-
Annotations are stored in the :attr:`__annotations__` attribute of the function
686-
as a dictionary and have no effect on any other part of the function. Parameter
687-
annotations are defined by a colon after the parameter name, followed by an
688-
expression evaluating to the value of the annotation. Return annotations are
685+
:term:`Annotations <function annotation>` are stored in the :attr:`__annotations__`
686+
attribute of the function as a dictionary and have no effect on any other part of the
687+
function. Parameter annotations are defined by a colon after the parameter name, followed
688+
by an expression evaluating to the value of the annotation. Return annotations are
689689
defined by a literal ``->``, followed by an expression, between the parameter
690690
list and the colon denoting the end of the :keyword:`def` statement. The
691691
following example has a positional argument, a keyword argument, and the return

0 commit comments

Comments
 (0)
0