Skip to content

Commit e9a6048

Browse files
authored
PEP 647: Mark as Final (take 2) (#3737)
1 parent 79bcaae commit e9a6048

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

peps/pep-0647.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Title: User-Defined Type Guards
33
Author: Eric Traut <erictr at microsoft.com>
44
Sponsor: Guido van Rossum <[email protected]>
55
Discussions-To: [email protected]
6-
Status: Accepted
6+
Status: Final
77
Type: Standards Track
88
Topic: Typing
99
Created: 07-Oct-2020
@@ -94,7 +94,7 @@ are supported by type checkers.
9494
Using this new mechanism, the ``is_str_list`` function in the above example
9595
would be modified slightly. Its return type would be changed from ``bool``
9696
to ``TypeGuard[List[str]]``. This promises not merely that the return value
97-
is boolean, but that a true indicates the input to the function was of the
97+
is boolean, but that a true indicates the input to the function was of the
9898
specified type.
9999

100100
::
@@ -200,9 +200,9 @@ allows for cases like the example above where ``List[str]`` is not assignable
200200
to ``List[object]``.
201201

202202
When a conditional statement includes a call to a user-defined type guard
203-
function, and that function returns true, the expression passed as the first
204-
positional argument to the type guard function should be assumed by a static
205-
type checker to take on the type specified in the TypeGuard return type,
203+
function, and that function returns true, the expression passed as the first
204+
positional argument to the type guard function should be assumed by a static
205+
type checker to take on the type specified in the TypeGuard return type,
206206
unless and until it is further narrowed within the conditional code block.
207207

208208
Some built-in type guards provide narrowing for both positive and negative
@@ -223,7 +223,7 @@ is not narrowed in the negative case.
223223
else:
224224
reveal_type(val) # OneOrTwoStrs
225225
...
226-
226+
227227
if not is_two_element_tuple(val):
228228
reveal_type(val) # OneOrTwoStrs
229229
...

0 commit comments

Comments
 (0)