8000 [doc] bpo-45680: Disambiguate ``__getitem__`` and ``__class_getitem__`` in the data model. by AlexWaygood · Pull Request #29389 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[doc] bpo-45680: Disambiguate __getitem__ and __class_getitem__ in the data model. #29389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 18, 2021
Prev Previous commit
Next Next commit
Improve links to typing docs
  • Loading branch information
AlexWaygood committed Nov 4, 2021
commit 7ae4fac3de3d68a1a5c2c3f911290b595993e8ab
1 change: 1 addition & 0 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ called :class:`TypeVar`.
def first(l: Sequence[T]) -> T: # Generic function
return l[0]

.. _user-defined-generics:

User-defined generic types
==========================
Expand Down
6 changes: 3 additions & 3 deletions Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2228,9 +2228,9 @@ For example, the annotation ``list[int]`` might be used to signify a
:ref:`Generic Alias Types<types-genericalias>`
Documentation for objects representing parameterized generic classes

:class:`typing.Generic`
Inherit from :class:`typing.Generic` to implement generic classes that
can be parameterized at runtime and understood by static type-checkers.
:ref:`Generics`, :ref:`user-defined generics<user-defined-generics>` and :class:`typing.Generic`
Documentation on how to implement generic classes that can be
parameterized at runtime and understood by static type-checkers.

A class can generally only be parameterized if it defines the special
classmethod ``__class_getitem__()``.
Expand Down
0