17
17
18
18
--------------
19
19
20
- This module provides runtime support for type hints as specified by
21
- :pep: `484 `, :pep: `526 `, :pep: `544 `, :pep: `586 `, :pep: `589 `, and :pep: `591 `.
22
- The most fundamental support consists of the types :data: `Any `, :data: `Union `,
23
- :data: `Tuple `, :data: `Callable `, :class: `TypeVar `, and
24
- :class: `Generic `. For full specification please see :pep: `484 `. For
25
- a simplified introduction to type hints see :pep: `483 `.
20
+ This module provides runtime support for type hints. The most fundamental
21
+ support consists of the types :data: `Any `, :data: `Union `, :data: `Tuple `,
22
+ :data: `Callable `, :class: `TypeVar `, and :class: `Generic `. For a full
23
+ specification, please see :pep: `484 `. For a simplified introduction to type
24
+ hints, see :pep: `483 `.
26
25
27
26
28
27
The function below takes and returns a string and is annotated as follows::
@@ -34,6 +33,33 @@ In the function ``greeting``, the argument ``name`` is expected to be of type
34
33
:class: `str ` and the return type :class: `str `. Subtypes are accepted as
35
34
arguments.
36
35
36
+ .. _relevant-peps :
37
+
38
+ Relevant PEPs
39
+ =============
40
+
41
+ Since the initial introduction of type hints in :pep: `484 ` and :pep: `483 `, a
42
+ number of PEPs have modified and enhanced Python's framework for type
43
+ annotations. These include:
44
+
45
+ * :pep: `526 `: Syntax for Variable Annotations
46
+ *Introducing * syntax for annotating variables outside of function
47
+ definitions, and :data: `ClassVar `
48
+ * :pep: `544 `: Protocols: Structural subtyping (static duck typing)
49
+ *Introducing * :class: `Protocol ` and the
50
+ :func: `@runtime_checkable<runtime_checkable> ` decorator
51
+ * :pep: `585 `: Type Hinting Generics In Standard Collections
52
+ *Introducing * the ability to use builtin collections and ABCs as
53
+ :term: `generic types<generic type> `
54
+ * :pep: `586 `: Literal Types
55
+ *Introducing * :class: `Literal `
56
+ * :pep: `589 `: TypedDict: Type Hints for Dictionaries with a Fixed Set of Keys
57
+ *Introducing * :class: `TypedDict `
58
+ * :pep: `591 `: Adding a final qualifier to typing
59
+ *Introducing * :data: `Final ` and the :func: `@final<final> ` decorator
60
+ * :pep: `593 `: Flexible function and variable annotations
61
+ *Introducing * :class: `Annotated `
62
+
37
63
Type aliases
38
64
============
39
65
0 commit comments