summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew
diff options
context:
space:
mode:
authorlarryhastings <larry@hastings.org>2021-05-02 04:19:24 (GMT)
committerGitHub <noreply@github.com>2021-05-02 04:19:24 (GMT)
commit49b26fa517165f991c35a4afcbef1fcb26836bec (patch)
tree1dd85a398089b1f909365d3bf9c38339f4c93db8 /Doc/whatsnew
parent318ca1764ca02692e19e5ea05078281b93c8106a (diff)
downloadcpython-49b26fa517165f991c35a4afcbef1fcb26836bec.zip
cpython-49b26fa517165f991c35a4afcbef1fcb26836bec.tar.gz
cpython-49b26fa517165f991c35a4afcbef1fcb26836bec.tar.bz2
bpo-43987: Add "Annotations Best Practices" HOWTO doc. (#25746)
Add "Annotations Best Practices" HOWTO doc.
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r--Doc/whatsnew/3.10.rst8
1 files changed, 6 insertions, 2 deletions
diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
index a59e2e5..679522b 100644
--- a/Doc/whatsnew/3.10.rst
+++ b/Doc/whatsnew/3.10.rst
@@ -807,7 +807,9 @@ Other Language Changes
* Class and module objects now lazy-create empty annotations dicts on demand.
The annotations dicts are stored in the object’s ``__dict__`` for
- backwards compatibility.
+ backwards compatibility. This improves the best practices for working
+ with ``__annotations__``; for more information, please see
+ :ref:`annotations-howto`.
(Contributed by Larry Hastings in :issue:`43901`.)
New Modules
@@ -996,7 +998,9 @@ defined on an object. It works around the quirks of accessing the annotations
on various types of objects, and makes very few assumptions about the object
it examines. :func:`inspect.get_annotations` can also correctly un-stringize
stringized annotations. :func:`inspect.get_annotations` is now considered
-best practice for accessing the annotations dict defined on any Python object.
+best practice for accessing the annotations dict defined on any Python object;
+for more information on best practices for working with annotations, please see
+:ref:`annotations-howto`.
Relatedly, :func:`inspect.signature`,
:func:`inspect.Signature.from_callable`, and ``inspect.Signature.from_function``
now call :func:`inspect.get_annotations` to retrieve annotations. This means