[docs] [issue32769] Add 'annotations' to the glossary
report at bugs.python.org
Tue May 15 00:06:37 EDT 2018
Łukasz Langa <lukasz at langa.pl> added the comment:
Guido, do you really want to stress at this point for Python 3.8 that annotations do not have an intended purpose? That is clearly not true.
1. PEP 526 was created purely with types in mind and was inspired by PEP 484's lack of this functionality.
2. PEP 563 defines a future import which will become the default in a future release (currently marked as 4.0). This default stops evaluating annotations at runtime, which again was inspired by the typing use case.
3. Dataclasses in PEP 557 are designed to leverage types in annotations. A few quotes from that PEP:
> A class decorator is provided which inspects a class definition for variables with type annotations as defined in PEP 526, "Syntax for Variable Annotations".
> One main design goal of Data Classes is to support static type checkers. The use of PEP 526 syntax is one example of this, but so is the design of the fields() function and the @dataclass decorator.
4. PEP 560 added support for `__class_getitem__` and `__mro_entries__` in core purely for the purpose of generic types.
5. For the above reasons, PEP 563 states that non-typing usage of annotations is deprecated:
Python tracker <report at bugs.python.org>
More information about the docs