@@ -3053,6 +3053,7 @@ Constant
3053
3053
.. versionadded :: 3.5.2
3054
3054
3055
3055
.. _generic-concrete-collections :
3056
+ .. _deprecated-aliases :
3056
3057
3057
3058
Deprecated aliases
3058
3059
------------------
@@ -3061,16 +3062,21 @@ This module defines several deprecated aliases to pre-existing
3061
3062
standard library classes. These were originally included in the typing
3062
3063
module in order to support parameterizing these generic classes using ``[] ``.
3063
3064
However, the aliases became redundant in Python 3.9 when the
3064
- corresponding pre-existing classes were enhanced to support ``[] ``.
3065
+ corresponding pre-existing classes were enhanced to support ``[] `` (see
3066
+ :pep: `585 `).
3065
3067
3066
- The redundant types are deprecated as of Python 3.9 but no
3067
- deprecation warnings are issued by the interpreter.
3068
- It is expected that type checkers will flag the deprecated types
3069
- when the checked program targets Python 3.9 or newer .
3068
+ The redundant types are deprecated as of Python 3.9. However, while the aliases
3069
+ may be removed at some point, removal of these aliases is not currently
3070
+ planned. As such, no deprecation warnings are currently issued by the
3071
+ interpreter for these aliases .
3070
3072
3071
- The deprecated types will be removed from the :mod: `typing ` module
3072
- no sooner than the first Python version released 5 years after the release of Python 3.9.0.
3073
- See details in :pep: `585 `—*Type Hinting Generics In Standard Collections *.
3073
+ If at some point it is decided to remove these deprecated aliases, a
3074
+ deprecation warning will be issued by the interpreter for at least two releases
3075
+ prior to removal. The aliases are guaranteed to remain in the typing module
3076
+ without deprecation warnings until at least Python 3.14.
3077
+
3078
+ Type checkers are encouraged to flag uses of the deprecated types if the
3079
+ program they are checking targets a minimum Python version of 3.9 or newer.
3074
3080
3075
3081
.. _corresponding-to-built-in-types :
3076
3082
@@ -3611,21 +3617,34 @@ Certain features in ``typing`` are deprecated and may be removed in a future
3611
3617
version of Python. The following table summarizes major deprecations for your
3612
3618
convenience. This is subject to change, and not all deprecations are listed.
3613
3619
3614
- +----------------------------------+---------------+-------------------+----------------+
3615
- | Feature | Deprecated in | Projected removal | PEP/issue |
3616
- +==================================+===============+===================+================+
3617
- | ``typing.io `` and ``typing.re `` | 3.8 | 3.13 | :issue: `38291 ` |
3618
- | submodules | | | |
3619
- +----------------------------------+---------------+-------------------+----------------+
3620
- | ``typing `` versions of standard | 3.9 | Undecided | :pep: `585 ` |
3621
- | collections | | | |
3622
- +----------------------------------+---------------+-------------------+----------------+
3623
- | ``typing.ByteString `` | 3.9 | 3.14 | :gh: `91896 ` |
3624
- +----------------------------------+---------------+-------------------+----------------+
3625
- | ``typing.Text `` | 3.11 | Undecided | :gh: `92332 ` |
3626
- +----------------------------------+---------------+-------------------+----------------+
3627
- | ``typing.Hashable `` and | 3.12 | Undecided | :gh: `94309 ` |
3628
- | ``typing.Sized `` | | | |
3629
- +----------------------------------+---------------+-------------------+----------------+
3630
- | ``typing.TypeAlias `` | 3.12 | Undecided | :pep: `695 ` |
3631
- +----------------------------------+---------------+-------------------+----------------+
3620
+ .. list-table ::
3621
+ :header-rows: 1
3622
+
3623
+ * - Feature
3624
+ - Deprecated in
3625
+ - Projected removal
3626
+ - PEP/issue
3627
+ * - ``typing.io `` and ``typing.re `` submodules
3628
+ - 3.8
3629
+ - 3.13
3630
+ - :issue: `38291 `
3631
+ * - ``typing `` versions of standard collections
3632
+ - 3.9
3633
+ - Undecided (see :ref: `deprecated-aliases ` for more information)
3634
+ - :pep: `585 `
3635
+ * - :class: `typing.ByteString `
3636
+ - 3.9
3637
+ - 3.14
3638
+ - :gh: `91896 `
3639
+ * - :data: `typing.Text `
3640
+ - 3.11
3641
+ - Undecided
3642
+ - :gh: `92332 `
3643
+ * - :class: `typing.Hashable ` and :class: `typing.Sized `
3644
+ - 3.12
3645
+ - Undecided
3646
+ - :gh: `94309 `
3647
+ * - :data: `typing.TypeAlias `
3648
+ - 3.12
3649
+ - Undecided
3650
+ - :pep: `695 `
0 commit comments