Skip to content

Commit a8a1967

Browse files
committed
Minor changes. Add type hint entry
1 parent f37d36c commit a8a1967

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

Doc/glossary.rst

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ Glossary
4040
ABCs with the :mod:`abc` module.
4141

4242
annotation
43-
A type metadata value associated with a global variable, a class
44-
attribute, or function parameter/return value.
43+
A metadata value associated with a global variable, a class variable or a
44+
function or method parameter or return value, that stores a
45+
:term:`type hint`.
4546

4647
Annotations are stored in the :attr:`__annotations__` special attribute
4748
of a module (when annotating a global variable), class (when annotating
48-
one of its attributes) or function (when annotating its parameters or
49+
a class variable) or function or method (when annotating a parameter or a
4950
return value) and can be accessed using :func:`typing.get_type_hints`.
5051

5152
See :pep:`484` and :pep:`526` which describe this functionality.
@@ -378,7 +379,7 @@ Glossary
378379
and the :ref:`function` section.
379380

380381
function annotation
381-
An :term:`annotation` of a function or method.
382+
An :term:`annotation` of a function, or a method.
382383

383384
For example, this function has its parameters annotated as taking
384385
:class:`int` arguments and its return value annotated as being an
@@ -1023,6 +1024,18 @@ Glossary
10231024
:attr:`~instance.__class__` attribute or can be retrieved with
10241025
``type(obj)``.
10251026

1027+
type hint
1028+
An specification about the expected type for a global variable, class
1029+
variable, function or method parameter or return value.
1030+
1031+
While type hints are optional and are not enforced by Python when used,
1032+
they are very useful for static type analysis tools, and aid IDEs on code
1033+
completion and refactoring.
1034+
1035+
Type hints are stored in :term:`annotations <annotation>`.
1036+
1037+
See also :pep:`483` which describe this functionality.
1038+
10261039
universal newlines
10271040
A manner of interpreting text streams in which all of the following are
10281041
recognized as ending a line: the Unix end-of-line convention ``'\n'``,
@@ -1031,7 +1044,7 @@ Glossary
10311044
:func:`bytes.splitlines` for an additional use.
10321045

10331046
variable annotation
1034-
An :term:`annotation` of a global variable, or class variable.
1047+
An :term:`annotation` of a global variable, or a class variable.
10351048

10361049
For example, this variable is annotated as taking :class:`int` values::
10371050

@@ -1044,7 +1057,7 @@ Glossary
10441057

10451058
Its syntax is explained in section :ref:`annassign`.
10461059

1047-
See also the :term:`function annotation` glossary entry, see :pep:`484`
1060+
See also the :term:`function annotation` glossary entry, and :pep:`484`
10481061
and :pep:`526` which describe this functionality.
10491062

10501063
virtual environment

0 commit comments

Comments
 (0)