bpo-45680: `typing docs: improve links to docs on GenericAlias/__class_getitem__` (GH-29387)

This commit is contained in:
Alex Waygood 2021-11-04 04:06:34 +00:00 committed by GitHub
parent c273986711
commit e03e50377d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -49,8 +49,8 @@ annotations. These include:
*Introducing* :class:`Protocol` and the
:func:`@runtime_checkable<runtime_checkable>` decorator
* :pep:`585`: Type Hinting Generics In Standard Collections
*Introducing* the ability to use builtin collections and ABCs as
:term:`generic types<generic type>`
*Introducing* :class:`types.GenericAlias` and the ability to use standard
library classes as :ref:`generic types<types-genericalias>`
* :pep:`586`: Literal Types
*Introducing* :data:`Literal`
* :pep:`589`: TypedDict: Type Hints for Dictionaries with a Fixed Set of Keys
@ -291,8 +291,8 @@ A user-defined class can be defined as a generic class.
single type parameter ``T`` . This also makes ``T`` valid as a type within the
class body.
The :class:`Generic` base class defines :meth:`__class_getitem__` so that
``LoggedVar[t]`` is valid as a type::
The :class:`Generic` base class defines :meth:`~object.__class_getitem__` so
that ``LoggedVar[t]`` is valid as a type::
from collections.abc import Iterable

View file

@ -0,0 +1,3 @@
Amend the docs on ``GenericAlias`` objects to clarify that non-container
classes can also implement ``__class_getitem__``. Patch contributed by Alex
Waygood.