Skip to content

Commit 8d7c1d9

Browse files
committed
Mention inheriting from a generic in ways to define a class as generic.
1 parent 057f9bf commit 8d7c1d9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

docs/spec/generics.rst

+8-5
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,14 @@ This is equivalent to omitting the generic notation and just saying
9393
User-defined generic types
9494
--------------------------
9595

96-
You can define a user-defined class as generic in three ways: by including a
97-
``Generic`` base class, by using the new generic class syntax in Python 3.12
98-
and higher, or by including a ``Protocol`` base class parameterized with type
99-
variables. The third approach also marks the class as a protocol - see
100-
:ref:`generic protocols<generic-protocols>` for more information.
96+
There are several ways to define a user-defined class as generic:
97+
98+
* Include a ``Generic`` base class.
99+
* Use the new generic class syntax in Python 3.12 and higher.
100+
* Include a `` Protocol`` base class parameterized with type variables. This
101+
approach also marks the class as a protocol - see
102+
:ref:`generic protocols<generic-protocols>` for more information.
103+
* Include a generic base class parameterized with type variables.
101104

102105
Example using ``Generic``::
103106

0 commit comments

Comments
 (0)