]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.9] bpo-45680: Clarify documentation on ``GenericAlias`` objects (GH-29335) (GH...
authorKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Wed, 19 Jan 2022 16:01:30 +0000 (00:01 +0800)
committerGitHub <noreply@github.com>
Wed, 19 Jan 2022 16:01:30 +0000 (00:01 +0800)
commit00645166b64e68001a425a15281a1ccdcb78f818
tree1e93c32f3c2fe679b571136c044c97c4460b388d
parent331378dffc334c1f05ab3152c87f46cd9155e169
[3.9] bpo-45680: Clarify documentation on ``GenericAlias`` objects (GH-29335) (GH-30689)

The documentation on ``GenericAlias`` objects implies at multiple points that
only container classes can define ``__class_getitem__``. This is misleading.
This PR proposes a rewrite of the documentation to clarify that non-container
classes can define ``__class_getitem__``, and to clarify what it means when a
non-container class is parameterized.

See also: initial discussion of issues with this piece of documentation in
GH-29308, and previous BPO issue [42280](https://bugs.python.org/issue42280).

Also improved references in glossary and typing docs. Fixed some links.

(cherry picked from commit 0eae9a2a2db6cc5a72535f61bb988cc417011640)

Co-Authored-By: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Co-Authored-By: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-Authored-By: Alex Waygood <Alex.Waygood@Gmail.com>
Doc/library/stdtypes.rst