Skip to content

Commit f043cd6

Browse files
methaneAA-Turnervpoulailleau
authored
Apply suggestions from code review
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Vincent Poulailleau <vpoulailleau@gmail.com>
1 parent 0cb92cb commit f043cd6

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

peps/pep-0781.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PEP: 781
2-
Title: Make ``TYPE_CHECKING`` builtin
2+
Title: Make ``TYPE_CHECKING`` a built-in constant
33
Author: Inada Naoki <songofacandy@gmail.com>
44
Discussions-To: https://discuss.python.org/t/85728
55
Status: Draft
@@ -14,11 +14,11 @@ Post-History: `11-Jan-2025 <https://discuss.python.org/t/76766>`__,
1414
Abstract
1515
========
1616

17-
This PEP proposes adding a new builtin, :data:`!TYPE_CHECKING`, to improve
17+
This PEP proposes adding a new built-in variable, :data:`!TYPE_CHECKING`, to improve
1818
the experience of writing Python code with type annotations. It is evaluated
1919
as ``True`` when the code is being analyzed by a static type checker, and as
2020
``False`` during normal runtime execution. Unlike :data:`typing.TYPE_CHECKING`,
21-
which this keyword replaces, it does not require an import statement.
21+
which this variable replaces, it does not require an import statement.
2222

2323

2424
Motivation
@@ -29,7 +29,7 @@ widespread adoption. A challenge with fully-annotated code is that many
2929
more imports are required in order to bring the relevant name into scope,
3030
potentially causing import cycles without careful design. This has been
3131
recognized by :pep:`563` and later :pep:`649`, which introduce two different
32-
mechanisms for deferred evaluation of type annotations. As :pep:`563` notes,
32+
mechanisms for deferred evaluation of type annotations. As PEP 563 notes,
3333
"type hints are ... not computationally free". The :data:`typing.TYPE_CHECKING`
3434
constant was thus introduced__, initially to aid in breaking cyclic imports.
3535

@@ -75,13 +75,13 @@ Since ``TYPE_CHECKING`` doesn't prohibit assignment, existing code using
7575

7676
.. code-block:: python
7777
78-
# These code will work as before
78+
# This code will continue to work
7979
TYPE_CHECKING = False
8080
from typing import TYPE_CHECKING
8181
8282
83-
User can remove the assingment to ``TYPE_CHECKING`` after they stop using
84-
Python before 3.14.
83+
User can remove the assignment to ``TYPE_CHECKING`` after they stop using
84+
Python 3.13 or older versions.
8585

8686

8787
How to Teach This
@@ -90,7 +90,7 @@ How to Teach This
9090
* Use ``if TYPE_CHECKING:`` for skipping type-checking code at runtime.
9191
* Use ``from typing import TYPE_CHECKING`` to support Python versions before 3.14.
9292
* Workarounds like ``TYPE_CHECKING = False`` or ``if False: # TYPE_CHECKING``
93-
are continued to work, but not recommended.
93+
will continue to work, but are not recommended.
9494

9595

9696
Reference Implementation
@@ -102,7 +102,7 @@ Reference Implementation
102102
Rejected Ideas
103103
==============
104104

105-
Eliminate type-checking-only Code
105+
Eliminate type-checking-only code
106106
---------------------------------
107107

108108
It is considered to add real constant named ``__type_checking__``

0 commit comments

Comments
 (0)