Skip to content

Commit e9fd0eb

Browse files
committed
reword docs, thanks Adam
1 parent 730daa1 commit e9fd0eb

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Doc/library/annotationlib.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,9 @@ Functions
304304

305305
Retrieve the :term:`annotate function` from a class namespace dictionary *namespace*.
306306
Return :const:`!None` if the namespace does not contain an annotate function.
307-
This is useful in :ref:`metaclasses <metaclasses>` to retrieve the annotate function;
308-
see :ref:`below <annotationlib-metaclass>` for an example.
307+
This is primarily useful before the class has been fully created (e.g., in a metaclass);
308+
after the class exists, the annotate function can be retrieved with ``cls.__annotate__``.
309+
See :ref:`below <annotationlib-metaclass>` for an example using this function in a metaclass.
309310

310311
.. versionadded:: 3.14
311312

@@ -429,7 +430,9 @@ that calls the original annotate function, makes any necessary adjustments, and
429430
returns the result.
430431

431432
Below is an example of a metaclass that filters out all :class:`typing.ClassVar`
432-
annotations from the class and puts them in a separate attribute::
433+
annotations from the class and puts them in a separate attribute:
434+
435+
.. code-block:: python
433436
434437
import annotationlib
435438
import typing

Doc/reference/datamodel.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,7 @@ Special attributes
12281228
:attr:`__annotations__ attributes <object.__annotations__>`.
12291229

12301230
For best practices on working with :attr:`~object.__annotations__`,
1231-
please see :mod:`annotationlib`. It is recommended to use
1231+
please see :mod:`annotationlib`. Where possible, use
12321232
:func:`annotationlib.get_annotations` instead of accessing this
12331233
attribute directly.
12341234

0 commit comments

Comments
 (0)