Skip to content

Commit e813dd4

Browse files
bpo-45680: typing docs: improve links to docs on GenericAlias/__class_getitem__ (GH-29387)
(cherry picked from commit e03e503) Co-authored-by: Alex Waygood <[email protected]>
1 parent 8198617 commit e813dd4

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* :class:`Literal`
5656
* :pep:`589`: TypedDict: Type Hints for Dictionaries with a Fixed Set of Keys
@@ -258,8 +258,8 @@ A user-defined class can be defined as a generic class.
258258
single type parameter ``T`` . This also makes ``T`` valid as a type within the
259259
class body.
260260

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

264264
from collections.abc import Iterable
265265

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)