Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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>`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, why'd the link change from the one in the glossary to about types-genericalias?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My reasoning was:

  • I think the types-genericalias link is more informative about the change that was introduced in the PEP.
  • I think it's an important piece of documentation that deserves a prominent mention near the top of the typing docs.
  • It's consistent with the link to types-union in the bullet point about PEP 604.

But I'm very happy to revert this change if you think the link to the glossary is more appropriate here 🙂

* :pep:`586`: Literal Types
*Introducing* :data:`Literal`
* :pep:`589`: TypedDict: Type Hints for Dictionaries with a Fixed Set of Keys
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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.