summaryrefslogtreecommitdiffstats
path: root/Doc/glossary.rst
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2024-09-11 14:49:59 (GMT)
committerGitHub <noreply@github.com>2024-09-11 14:49:59 (GMT)
commit5436d8b9c397c48d9b0d5f9d4ad5e1d5a5d500f6 (patch)
treebb571e7d215b3f11f9e7d60a095bd1b050d24f9a /Doc/glossary.rst
parent6e23c89fcdd02b08fa6e9fa70d6e90763ddfc327 (diff)
downloadcpython-5436d8b9c397c48d9b0d5f9d4ad5e1d5a5d500f6.zip
cpython-5436d8b9c397c48d9b0d5f9d4ad5e1d5a5d500f6.tar.gz
cpython-5436d8b9c397c48d9b0d5f9d4ad5e1d5a5d500f6.tar.bz2
gh-119180: Documentation for PEP 649 and 749 (#122235)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Diffstat (limited to 'Doc/glossary.rst')
-rw-r--r--Doc/glossary.rst20
1 files changed, 15 insertions, 5 deletions
diff --git a/Doc/glossary.rst b/Doc/glossary.rst
index d9f9392..ea2f4da 100644
--- a/Doc/glossary.rst
+++ b/Doc/glossary.rst
@@ -36,6 +36,12 @@ Glossary
and loaders (in the :mod:`importlib.abc` module). You can create your own
ABCs with the :mod:`abc` module.
+ annotate function
+ A function that can be called to retrieve the :term:`annotations <annotation>`
+ of an object. This function is accessible as the :attr:`~object.__annotate__`
+ attribute of functions, classes, and modules. Annotate functions are a
+ subset of :term:`evaluate functions <evaluate function>`.
+
annotation
A label associated with a variable, a class
attribute or a function parameter or return value,
@@ -43,12 +49,11 @@ Glossary
Annotations of local variables cannot be accessed at runtime, but
annotations of global variables, class attributes, and functions
- are stored in the :attr:`__annotations__`
- special attribute of modules, classes, and functions,
- respectively.
+ can be retrieved by calling :func:`annotationlib.get_annotations`
+ on modules, classes, and functions, respectively.
- See :term:`variable annotation`, :term:`function annotation`, :pep:`484`
- and :pep:`526`, which describe this functionality.
+ See :term:`variable annotation`, :term:`function annotation`, :pep:`484`,
+ :pep:`526`, and :pep:`649`, which describe this functionality.
Also see :ref:`annotations-howto`
for best practices on working with annotations.
@@ -366,6 +371,11 @@ Glossary
statements. The technique contrasts with the :term:`LBYL` style
common to many other languages such as C.
+ evaluate function
+ A function that can be called to evaluate a lazily evaluated attribute
+ of an object, such as the value of type aliases created with the :keyword:`type`
+ statement.
+
expression
A piece of syntax which can be evaluated to some value. In other words,
an expression is an accumulation of expression elements like literals,