Skip to content

Commit 65cf186

Browse files
committed
Add items to the soft deprecations document
1 parent 467ec51 commit 65cf186

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Doc/deprecations/soft-deprecations.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,19 @@ There are no plans to remove :term:`soft deprecated` APIs.
1919

2020
(Contributed by Gregory P. Smith in :gh:`86519` and
2121
Hugo van Kemenade in :gh:`148100`.)
22+
23+
* The following typing-related classes are :term:`soft deprecated`:
24+
25+
* :class:`typing.Optional` in favor of the dedicated union syntax
26+
(``X | None``)
27+
* :class:`typing.NoReturn` in favor of :class:`typing.Never`
28+
* :class:`typing.ForwardRef` in favor of :class:`annotationlib.ForwardRef`
29+
* :class:`types.UnionType` in favor of :class:`typing.Union` (but see below)
30+
31+
Creating :class:`typing.Union` instances using the constructor is also
32+
deprecated. Use the dedicated union syntax (``X | Y``) instead.
33+
34+
Explicitly inheriting from :class:`typing.Generic` is also deprecated.
35+
Use the dedicated syntax for :ref:`generic functions <generic-functions>`,
36+
:ref:`generic classes <generic-classes>`, and
37+
:ref:`generic type aliases <generic-type-aliases>` instead.

0 commit comments

Comments
 (0)