summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-11-04 04:34:31 (GMT)
committerGitHub <noreply@github.com>2021-11-04 04:34:31 (GMT)
commite813dd4d7bb0ecfabc7dae75e13f58164bcf8da6 (patch)
tree56f0c08f1d228199036dd08ad122c68082864697
parent8198617bcce885c280ba5f8acd066c71b311b1ac (diff)
downloadcpython-e813dd4d7bb0ecfabc7dae75e13f58164bcf8da6.zip
cpython-e813dd4d7bb0ecfabc7dae75e13f58164bcf8da6.tar.gz
cpython-e813dd4d7bb0ecfabc7dae75e13f58164bcf8da6.tar.bz2
bpo-45680: ``typing`` docs: improve links to docs on ``GenericAlias``/``__class_getitem__`` (GH-29387)
(cherry picked from commit e03e50377d6f8f212af60fed4ae405ebeb73237d) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
-rw-r--r--Doc/library/typing.rst8
-rw-r--r--Misc/NEWS.d/next/Documentation/2021-11-03-14-51-03.bpo-45680.9_NTFU.rst3
2 files changed, 7 insertions, 4 deletions
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index 295f2ae..068112d 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -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* :class:`Literal`
* :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.
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
index 0000000..79ea6e3
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2021-11-03-14-51-03.bpo-45680.9_NTFU.rst
@@ -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.