@@ -63,9 +63,14 @@ Static type checkers must treat ``TYPE_CHECKING`` as ``True``, similar to
63
63
:data: `typing.TYPE_CHECKING `.
64
64
65
65
If this PEP is accepted, the new ``TYPE_CHECKING `` constant will be
66
- the preferred approach, instead of the existing ``typing.TYPE_CHECKING ``.
67
- However, ``typing.TYPE_CHECKING `` will not be deprecated in the foreseeable
68
- future.
66
+ the preferred approach and importing ``typing.TYPE_CHECKING `` will be
67
+ deprecated.
68
+ To minimize the runtime impact of typing, this deprecation will generate
69
+ ``DeprecationWarning `` no sooner than Python 3.13's end of life, scheduled
70
+ for October 2029.
71
+
72
+ Instead, type checkers may warn about such deprecated usage when the target
73
+ version of the checked program is signalled to be Python 3.14 or newer.
69
74
70
75
71
76
Backwards Compatibility
@@ -115,6 +120,20 @@ Benefit from eliminating type-checking-only code is estimated to be not enough
115
120
to justify the complexity.
116
121
117
122
123
+ Optimize ``import typing ``
124
+ --------------------------
125
+
126
+ Future optimizations may eliminate the need to avoid importing the ``typing ``
127
+ module for startup time.
128
+
129
+ Even with such optimizations, there will still be use cases where minimizing
130
+ imports is beneficial, such as running Python on embedded systems or
131
+ in browsers.
132
+
133
+ Therefore, defining a constant for skipping type-checking-only code outside
134
+ the ``typing `` module remains valuable.
135
+
136
+
118
137
Copyright
119
138
=========
120
139
0 commit comments