Skip to content

Commit e03e503

Browse files
authored
bpo-45680: typing docs: improve links to docs on GenericAlias/__class_getitem__ (GH-29387)
1 parent c273986 commit e03e503

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Doc/library/typing.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ annotations. These include:
4949
*Introducing* :class:`Protocol` and the
5050
:func:`@runtime_checkable<runtime_checkable>` decorator
5151
* :pep:`585`: Type Hinting Generics In Standard Collections
52-
*Introducing* the ability to use builtin collections and ABCs as
53-
:term:`generic types<generic type>`
52+
*Introducing* :class:`types.GenericAlias` and the ability to use standard
53+
library classes as :ref:`generic types<types-genericalias>`
5454
* :pep:`586`: Literal Types
5555
*Introducing* :data:`Literal`
5656
* :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.
291291
single type parameter ``T`` . This also makes ``T`` valid as a type within the
292292
class body.
293293

294-
The :class:`Generic` base class defines :meth:`__class_getitem__` so that
295-
``LoggedVar[t]`` is valid as a type::
294+
The :class:`Generic` base class defines :meth:`~object.__class_getitem__` so
295+
that ``LoggedVar[t]`` is valid as a type::
296296

297297
from collections.abc import Iterable
298298

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Amend the docs on ``GenericAlias`` objects to clarify that non-container
2+
classes can also implement ``__class_getitem__``. Patch contributed by Alex
3+
Waygood.

0 commit comments

Comments
 (0)