PEP 3107
E911261
PEP 3107 is the Python Enhancement Proposal that introduced function annotations, providing a standardized syntax for attaching metadata such as type information to function parameters and return values.
Statements (44)
| Predicate | Object |
|---|---|
| instanceOf | Python Enhancement Proposal ⓘ |
| acceptedBy | Python core developers ⓘ |
| allows | any Python expression as an annotation ⓘ |
| annotationStorage | __annotations__ attribute on functions ⓘ |
| author | Guido van Rossum NERFINISHED ⓘ |
| backwardsCompatibility | does not change function call semantics ⓘ |
| created | 2006-03-05 ⓘ |
| defines |
syntax for attaching metadata to function parameters
ⓘ
syntax for attaching metadata to function return values ⓘ |
| designGoal |
allow arbitrary metadata on function parameters
ⓘ
avoid enforcing a specific type system ⓘ keep annotations optional ⓘ |
| doesNotSpecify | how tools should interpret annotations ⓘ |
| implementedInVersion | Python 3.0 NERFINISHED ⓘ |
| influenced |
PEP 484
NERFINISHED
ⓘ
Python type hinting ecosystem ⓘ |
| introducedFeature | function annotations ⓘ |
| introducedSyntax |
parameter annotations
ⓘ
return value annotations ⓘ |
| language | Python NERFINISHED ⓘ |
| metadataKind |
documentation metadata
ⓘ
type information ⓘ validation metadata ⓘ |
| motivatedBy | need for standardized way to attach metadata to functions ⓘ |
| primaryUseCase |
documentation
ⓘ
static analysis ⓘ type information ⓘ |
| proposalNumber | 3107 ⓘ |
| pythonVersionIntroduced | Python 3.0 NERFINISHED ⓘ |
| relatedTo |
PEP 484
NERFINISHED
ⓘ
PEP 526 NERFINISHED ⓘ PEP 563 NERFINISHED ⓘ PEP 649 NERFINISHED ⓘ |
| replaces | earlier informal annotation proposals ⓘ |
| scope |
function definitions
ⓘ
method definitions ⓘ |
| semantics |
annotations are available for introspection
ⓘ
annotations have no runtime effect by default ⓘ |
| status | Final ⓘ |
| syntaxExample | def f(x: int) -> str: ... ⓘ |
| targetAudience | Python developers ⓘ |
| title | Function Annotations NERFINISHED ⓘ |
| type | Standards Track ⓘ |
| url | https://peps.python.org/pep-3107/ ⓘ |
Referenced by (1)
Full triples — surface form annotated when it differs from this entity's canonical label.