summaryrefslogtreecommitdiffstats
path: root/Doc/library/typing.rst
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-11-18 17:34:08 (GMT)
committerGitHub <noreply@github.com>2021-11-18 17:34:08 (GMT)
commitfde9f61e70bc38850783c81bf7c80c764ba6d9fa (patch)
tree1aa680c580914adc35f2ef09ce3eeee78005d72b /Doc/library/typing.rst
parent252d83cbf1bf0a6ac22a1347e760cd3e551bb834 (diff)
downloadcpython-fde9f61e70bc38850783c81bf7c80c764ba6d9fa.zip
cpython-fde9f61e70bc38850783c81bf7c80c764ba6d9fa.tar.gz
cpython-fde9f61e70bc38850783c81bf7c80c764ba6d9fa.tar.bz2
[3.10] [doc] bpo-45680: Disambiguate ``__getitem__`` and ``__class_getitem__`` in the data model (GH-29389) (GH-29620)
The documentation explaining Python's data model does not adequately explain the differences between ``__getitem__`` and ``__class_getitem__``, nor does it explain when each is called. There is an attempt at explaining ``__class_getitem__`` in the documentation for ``GenericAlias`` objects, but this does not give sufficient clarity into how the method works. Moreover, it is the wrong place for that information to be found; the explanation of ``__class_getitem__`` should be in the documentation explaining the data model. This PR has been split off from GH-29335. (cherry picked from commit 31b3a70edb1216bdc8fab3b2eafd8ddb00487f41) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Doc/library/typing.rst')
-rw-r--r--Doc/library/typing.rst1
1 files changed, 1 insertions, 0 deletions
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index c59afdd..14e5c8f 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -256,6 +256,7 @@ called :class:`TypeVar`.
def first(l: Sequence[T]) -> T: # Generic function
return l[0]
+.. _user-defined-generics:
User-defined generic types
==========================