]> granicus.if.org Git - python/commitdiff
bpo-35566: Add links to annotation glossary term (GH-11291)
authorCheryl Sabella <cheryl.sabella@gmail.com>
Mon, 24 Dec 2018 05:09:09 +0000 (00:09 -0500)
committerRaymond Hettinger <rhettinger@users.noreply.github.com>
Mon, 24 Dec 2018 05:09:09 +0000 (21:09 -0800)
Doc/library/dataclasses.rst
Doc/reference/compound_stmts.rst
Doc/reference/simple_stmts.rst
Doc/tutorial/controlflow.rst

index 072a500d9f8787560f1f3fd783c91c18dcba4b58..db5c3e0c7e28935357fef5125a73381c6c8ce5c6 100644 (file)
@@ -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.
index a83b561c13fa0ace4bcc56bb8ffbf2433627d643..42fa86476239357a2c46919cf054530ec24d81c4 100644 (file)
@@ -571,8 +571,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
index 0efbe1ce5d57d04e335299186fb17ee191833d87..00964afc6d3d2fb698c3a27e558cdaa334e3b390 100644 (file)
@@ -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`]
index 08eaa66a4069c988d2776244d76c1ab2ea1a2eec..905734539c685171f51f212dd08154c856e02293 100644 (file)
@@ -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