]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45680: ``typing`` docs: improve links to docs on ``GenericAlias``/``__class_getit...
authorAlex Waygood <Alex.Waygood@Gmail.com>
Thu, 4 Nov 2021 04:06:34 +0000 (04:06 +0000)
committerGitHub <noreply@github.com>
Thu, 4 Nov 2021 04:06:34 +0000 (12:06 +0800)
Doc/library/typing.rst
Misc/NEWS.d/next/Documentation/2021-11-03-14-51-03.bpo-45680.9_NTFU.rst [new file with mode: 0644]

index eb95af378d45fd043ae756c7736a2cc3a5bb50c5..79ca2e96431a669e45bc6761f6c1e6220406a8fc 100644 (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
 
diff --git a/Misc/NEWS.d/next/Documentation/2021-11-03-14-51-03.bpo-45680.9_NTFU.rst b/Misc/NEWS.d/next/Documentation/2021-11-03-14-51-03.bpo-45680.9_NTFU.rst
new file mode 100644 (file)
index 0000000..79ea6e3
--- /dev/null
@@ -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.