[Python-checkins] bpo-35566: Add links to annotation glossary term (GH-11291) (GH-11302)

Raymond Hettinger webhook-mailer at python.org
Mon Dec 24 00:18:43 EST 2018


https://github.com/python/cpython/commit/bc64123335a4b6e2c1e4be532c60e5e1086db59a
commit: bc64123335a4b6e2c1e4be532c60e5e1086db59a
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Raymond Hettinger <rhettinger at users.noreply.github.com>
date: 2018-12-23T21:18:39-08:00
summary:

bpo-35566: Add links to annotation glossary term (GH-11291) (GH-11302)

files:
M Doc/library/dataclasses.rst
M Doc/reference/compound_stmts.rst
M Doc/reference/simple_stmts.rst
M Doc/tutorial/controlflow.rst

diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst
index fe0feeda8b87..6af60b6e2694 100644
--- a/Doc/library/dataclasses.rst
+++ b/Doc/library/dataclasses.rst
@@ -51,9 +51,9 @@ Module-level decorators, classes, and functions
 
    The :func:`dataclass` decorator examines the class to find
    ``field``\s.  A ``field`` is defined as class variable that has a
-   type annotation.  With two exceptions described below, nothing in
-   :func:`dataclass` examines the type specified in the variable
-   annotation.
+   :term:`type annotation <variable annotation>`.  With two
+   exceptions described below, nothing in :func:`dataclass`
+   examines the type specified in the variable annotation.
 
    The order of the fields in all of the generated methods is the
    order in which they appear in the class definition.
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst
index db453fcdd1e0..1d84274b7996 100644
--- a/Doc/reference/compound_stmts.rst
+++ b/Doc/reference/compound_stmts.rst
@@ -570,8 +570,8 @@ used keyword arguments.
    single: ->; function annotations
    single: : (colon); function annotations
 
-Parameters may have annotations of the form "``: expression``" following the
-parameter name.  Any parameter may have an annotation even those of the form
+Parameters may have an :term:`annotation <function annotation>` of the form "``: expression``"
+following the parameter name.  Any parameter may have an annotation, even those of the form
 ``*identifier`` or ``**identifier``.  Functions may have "return" annotation of
 the form "``-> expression``" after the parameter list.  These annotations can be
 any valid Python expression.  The presence of annotations does not change the
diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst
index dcda309b58de..07072d954384 100644
--- a/Doc/reference/simple_stmts.rst
+++ b/Doc/reference/simple_stmts.rst
@@ -325,8 +325,8 @@ Annotated assignment statements
    single: statement; assignment, annotated
    single: : (colon); annotated variable
 
-Annotation assignment is the combination, in a single statement,
-of a variable or attribute annotation and an optional assignment statement:
+:term:`Annotation <variable annotation>` assignment is the combination, in a single
+statement, of a variable or attribute annotation and an optional assignment statement:
 
 .. productionlist::
    annotated_assignment_stmt: `augtarget` ":" `expression` ["=" `expression`]
diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst
index 08eaa66a4069..905734539c68 100644
--- a/Doc/tutorial/controlflow.rst
+++ b/Doc/tutorial/controlflow.rst
@@ -682,10 +682,10 @@ Function Annotations
 information about the types used by user-defined functions (see :pep:`3107` and
 :pep:`484` for more information).
 
-Annotations are stored in the :attr:`__annotations__` attribute of the function
-as a dictionary and have no effect on any other part of the function.  Parameter
-annotations are defined by a colon after the parameter name, followed by an
-expression evaluating to the value of the annotation.  Return annotations are
+:term:`Annotations <function annotation>` are stored in the :attr:`__annotations__`
+attribute of the function as a dictionary and have no effect on any other part of the
+function.  Parameter annotations are defined by a colon after the parameter name, followed
+by an expression evaluating to the value of the annotation.  Return annotations are
 defined by a literal ``->``, followed by an expression, between the parameter
 list and the colon denoting the end of the :keyword:`def` statement.  The
 following example has a positional argument, a keyword argument, and the return



More information about the Python-checkins mailing list