PEP 647
E916620
PEP 647 is the Python Enhancement Proposal that introduces "user-defined type guards," enabling more precise static type narrowing in Python code.
All labels observed (1)
| Label | Occurrences |
|---|---|
| PEP 647 canonical | 1 |
How this entity was disambiguated
This entity first appeared as the object of triple T10763905 — resolving that mention is where its identity was fixed. The disambiguator weighed these candidate entities and picked the highlighted one (or “None”, minting a new entity). This is how homonymy is resolved: the same surface form can point to different entities.
Target entity: PEP 647 Context triple: [Python 3.10, implementsPEP, PEP 647]
-
A.
PEP 644
PEP 644 is the Python Enhancement Proposal that mandates OpenSSL 1.1.1 or newer as the minimum supported version for Python’s standard ssl module, aligning Python’s security features with modern TLS capabilities.
-
B.
PEP 624
PEP 624 is a Python Enhancement Proposal that specifies the removal of the Py_UNICODE encoder APIs from the CPython C API to streamline and modernize Unicode handling in Python.
-
C.
PEP 634
PEP 634 is the Python Enhancement Proposal that formally specifies the semantics of structural pattern matching introduced in Python 3.10.
-
D.
PEP 604
PEP 604 is a Python Enhancement Proposal that introduced the modern, concise syntax for expressing type unions (using the `|` operator) in Python’s type hints.
-
E.
PEP 626
PEP 626 is a Python Enhancement Proposal that precisely defines how Python should map executed bytecode instructions to source code lines, improving debugging, coverage measurement, and tooling accuracy.
- F. None of above. chosen
- G. Unsure - the case is ambiguous/there is not enough information to decide.
Target entity: PEP 647 Target entity description: PEP 647 is the Python Enhancement Proposal that introduces "user-defined type guards," enabling more precise static type narrowing in Python code.
-
A.
PEP 644
PEP 644 is the Python Enhancement Proposal that mandates OpenSSL 1.1.1 or newer as the minimum supported version for Python’s standard ssl module, aligning Python’s security features with modern TLS capabilities.
-
B.
PEP 624
PEP 624 is a Python Enhancement Proposal that specifies the removal of the Py_UNICODE encoder APIs from the CPython C API to streamline and modernize Unicode handling in Python.
-
C.
PEP 634
PEP 634 is the Python Enhancement Proposal that formally specifies the semantics of structural pattern matching introduced in Python 3.10.
-
D.
PEP 604
PEP 604 is a Python Enhancement Proposal that introduced the modern, concise syntax for expressing type unions (using the `|` operator) in Python’s type hints.
-
E.
PEP 626
PEP 626 is a Python Enhancement Proposal that precisely defines how Python should map executed bytecode instructions to source code lines, improving debugging, coverage measurement, and tooling accuracy.
- F. None of above. chosen
Statements (48)
| Predicate | Object |
|---|---|
| instanceOf | Python Enhancement Proposal ⓘ |
| aimsTo | enable more precise static type narrowing ⓘ |
| allows |
functions to signal refined types to type checkers
ⓘ
user code to define custom type-narrowing functions ⓘ |
| author |
Jelle Zijlstra
NERFINISHED
ⓘ
Michael Lee NERFINISHED ⓘ |
| belongsTo | CPython PEP index NERFINISHED ⓘ |
| category | Typing ⓘ |
| clarifies |
difference between TypeGuard and bool return types
ⓘ
interaction of user-defined type guards with union types ⓘ |
| createdForPythonVersion | Python 3.10 NERFINISHED ⓘ |
| definesConstraint |
TypeGuard may only appear in the return type position of a function
ⓘ
TypeGuard return type must be a subtype of bool at runtime ⓘ |
| definesSyntaxElement |
TypeGuard return type
ⓘ
typing.TypeGuard NERFINISHED ⓘ |
| definesTerm | user-defined type guard ⓘ |
| discussesModule | typing NERFINISHED ⓘ |
| doesNotAffect | runtime semantics of Python programs ⓘ |
| ensures | type guards are only used in positive test positions ⓘ |
| firstIncludedIn | Python 3.10 GENERATED ⓘ |
| governsBehaviorOf | TypeGuard in typing module NERFINISHED ⓘ |
| hasTitle | User-Defined Type Guards NERFINISHED ⓘ |
| improves | precision of conditional type inference ⓘ |
| introducesConcept | user-defined type guards ⓘ |
| language | English ⓘ |
| modifiesTypingBehavior | type checkers ⓘ |
| motivatedBy |
limitations of isinstance-based narrowing
ⓘ
limitations of literal truthiness checks for narrowing ⓘ |
| notes | TypeGuard is intended for use by static type checkers only NERFINISHED ⓘ |
| partOf | Python typing ecosystem ⓘ |
| PEPNumber | 647 ⓘ |
| relatedTo |
PEP 484
NERFINISHED
ⓘ
PEP 544 NERFINISHED ⓘ PEP 589 NERFINISHED ⓘ |
| relatesToLanguage | Python GENERATED ⓘ |
| relatesToTopic |
static typing
ⓘ
type checking ⓘ type narrowing ⓘ |
| repository | https://peps.python.org/pep-0647/ ⓘ |
| specifies |
rules for how type checkers interpret TypeGuard
ⓘ
semantics of TypeGuard in conditional statements ⓘ |
| status | Accepted ⓘ |
| targetsAudience |
Python developers using static typing
ⓘ
library authors ⓘ type checker implementers ⓘ |
| useCase |
custom validation functions that narrow types
ⓘ
filtering heterogeneous collections ⓘ refining Optional types after checks ⓘ |
How these facts were elicited
The pipeline generated the facts above by prompting gpt-5.1 with this entity's name + description and the instruction below.
You are a knowledge base construction expert. Given a subject entity and a description of it, return factual statements that you know for the subject as a JSON list of dictionaries(triples), where keys must be "subject", "predicate" and "object". The number of facts may be very high, between 25 to 50 or more, for very popular subjects. For less popular subjects, the number of facts can be very low, like 5 or 10. # Requirements - If you don't know the subject at all, return an empty list. - If the subject is not a named entity, return an empty list. - Include at least one triple where predicate is "instanceOf". - Do not get too wordy. - Separate several objects into multiple triples with one object.
Subject: PEP 647 Description of subject: PEP 647 is the Python Enhancement Proposal that introduces "user-defined type guards," enabling more precise static type narrowing in Python code.
Referenced by (1)
Full triples — surface form annotated when it differs from this entity's canonical label.