]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-45680: Clarify documentation on ``GenericAlias`` objects (GH-29335)
authorAlex Waygood <Alex.Waygood@Gmail.com>
Wed, 19 Jan 2022 14:53:41 +0000 (14:53 +0000)
committerGitHub <noreply@github.com>
Wed, 19 Jan 2022 14:53:41 +0000 (22:53 +0800)
commit0eae9a2a2db6cc5a72535f61bb988cc417011640
treed44575b5deba875be0087277f4347b755a4662e0
parent2792d6d18eab3efeb71e6397f88db86e610541f1
bpo-45680: Clarify documentation on ``GenericAlias`` objects (GH-29335)

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.

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