Skip to content

Commit 7564afc

Browse files
committed
docs: improve wording for legacy syntax note
1 parent 9d1032e commit 7564afc

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

docs/reference/generics.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ Here is a very simple generic class that represents a stack:
3535
3636
.. note::
3737

38-
The type parameter syntax (e.g., ``class Foo[T]:``) is available in Python 3.12 and newer.
39-
For earlier Python versions, generic classes need to be defined using
40-
``TypeVar`` and ``Generic``, as shown below.
41-
42-
For compatibility with older Python versions, the same class may be written as:
38+
The type parameter syntax (for example, ``class Foo[T]:``) is available in
39+
Python 3.12 and newer. For earlier Python versions, use the legacy
40+
``TypeVar`` and ``Generic`` syntax shown below.
4341

4442
.. code-block:: python
4543
@@ -183,7 +181,7 @@ functions do not share any typing relationship to each other:
183181
return seq[-1]
184182
185183
Variables should not have a type parameter in their type unless the type parameter
186-
is bound by a containing generic class, generic function or generic alias.
184+
is bound by a containing generic class, generic function, or generic alias.
187185

188186
.. _generic-methods-and-generic-self:
189187

0 commit comments

Comments
 (0)