Statements (54)
Predicate | Object |
---|---|
gptkbp:instance_of |
gptkb:Python
|
gptkbp:abstract |
Introduce a new statement for resource management.
This PEP proposes a syntax for adding annotations to function parameters and return values. |
gptkbp:acceptance_date |
2005-09-01
|
gptkbp:accepted |
2006-01-01
|
gptkbp:amended_by |
Multiple revisions before final acceptance.
|
gptkbp:author |
gptkb:Guido_van_Rossum
|
gptkbp:benefits |
Automatic resource cleanup.
|
gptkbp:cause |
Simplifies exception handling and resource management.
|
gptkbp:concluded_on |
Enhances Python's resource management capabilities.
Function annotations are a powerful feature for type hinting. |
gptkbp:created |
2006-01-01
2005-05-01 |
gptkbp:discusses |
https://www.python.org/dev/peps/pep-0310/
python-dev mailing list https://www.python.org/dev/peps/pep-0310/#discussion |
gptkbp:example |
with open('file.txt') as f:
with open('file.txt') as f: pass def func(a: int, b: str) -> bool: pass. |
gptkbp:first_published |
2006-01-01
|
gptkbp:formulation |
with expression as variable:
|
https://www.w3.org/2000/01/rdf-schema#label |
PEP 310
|
gptkbp:impact |
Improved code readability and safety.
Introduced a way to attach metadata to function signatures. |
gptkbp:is_adopted_by |
Widely adopted in Python code.
|
gptkbp:is_implemented_in |
Python interpreter
Implemented in Python 3.0. Implemented in CPython 3.0 |
gptkbp:is_motivated_by |
To improve the readability and usability of function signatures.
|
gptkbp:is_referenced_in |
https://www.python.org/dev/peps/pep-0310/
|
gptkbp:keywords |
with, context manager, resource management
annotations, type hints |
gptkbp:latest_version |
PEP 310.1
|
gptkbp:plot_summary |
This PEP proposes a syntax for function annotations.
The 'with' statement simplifies exception handling. |
gptkbp:proposed_by |
gptkb:Guido_van_Rossum
|
gptkbp:proposed_implementation |
contextlib module
|
gptkbp:python_version |
gptkb:Python_3.0
2.5 |
gptkbp:related_concept |
try/finally
|
gptkbp:related_peps |
gptkb:PEP_484
PEP 343 |
gptkbp:related_to |
Type Hints
context manager |
gptkbp:replaces |
PEP 343
PEP 204 |
gptkbp:reviews |
gptkb:Python
|
gptkbp:status |
gptkb:Final
2006-01-01 |
gptkbp:title |
with statement
Function Annotations |
gptkbp:topics |
Type Checking
|
gptkbp:usage |
Used for file handling, locking, and resource management.
Used for type hinting in function definitions. |