From 5eb3e357c811d2de1cd821b8c8205ac1340f6a43 Mon Sep 17 00:00:00 2001 From: Victorien <65306057+Viicos@users.noreply.github.com> Date: Tue, 29 Oct 2024 20:22:14 +0100 Subject: [PATCH 1/2] Clarify runtime implementation of `Generic` --- docs/spec/generics.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/spec/generics.rst b/docs/spec/generics.rst index 2cb3f6f6..1f6a7fee 100644 --- a/docs/spec/generics.rst +++ b/docs/spec/generics.rst @@ -131,8 +131,8 @@ should treat the two largely equivalently (except for variance, see below). takes a single type parameter ``T``. This also makes ``T`` valid as a type within the class body. -The ``Generic`` base class uses a metaclass that defines ``__getitem__`` -so that ``LoggedVar[t]`` is valid as a type:: +The ``Generic`` base class implements the :func:`~object__class_getitem__` +classmethod so that ``LoggedVar[t]`` is valid as a type:: from collections.abc import Iterable From 9a91ed02973d5c2d5221e0df65b0b1f0f6a36e8a Mon Sep 17 00:00:00 2001 From: Victorien <65306057+Viicos@users.noreply.github.com> Date: Tue, 29 Oct 2024 20:22:45 +0100 Subject: [PATCH 2/2] fixup --- docs/spec/generics.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/spec/generics.rst b/docs/spec/generics.rst index 1f6a7fee..8fa222f8 100644 --- a/docs/spec/generics.rst +++ b/docs/spec/generics.rst @@ -131,7 +131,7 @@ should treat the two largely equivalently (except for variance, see below). takes a single type parameter ``T``. This also makes ``T`` valid as a type within the class body. -The ``Generic`` base class implements the :func:`~object__class_getitem__` +The ``Generic`` base class implements the :func:`~object.__class_getitem__` classmethod so that ``LoggedVar[t]`` is valid as a type:: from collections.abc import Iterable