8000 bpo-35566: Add links to annotation glossary term by csabella · Pull Request #11291 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-35566: Add links to annotation glossary term #11291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Doc/library/dataclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions Doc/reference/compound_stmts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Doc/reference/simple_stmts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`]
Expand Down
8 changes: 4 additions & 4 deletions Doc/tutorial/controlflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
0