@@ -8,7 +8,7 @@ Status: Draft
88Type: Standards Track
99Content-Type: text/x-rst
1010Created: 29-Sep-2014
11- Post-History:
11+ Post-History:
1212Resolution:
1313
1414
@@ -85,25 +85,21 @@ elements. Example::
8585 def notify_by_email(employees: Set[Employee], overrides: Mapping[str, str]): ...
8686
8787Generics can be parametrized by using a new factory available in
88- ``collections.abc`` called ``Var ``. Example::
88+ ``collections.abc`` called ``TypeVar ``. Example::
8989
90- T = Var ('T') # Declare type variable
90+ T = TypeVar ('T') # Declare type variable
9191
9292 def first(l: Sequence[T]) -> T: # Generic function
9393 return l[0]
9494
95- .. FIXME: Maybe rename Var to TypeVar to avoid confusion with simple
96- variables and a possible future syntax of the form
97- var name: type = value
98-
9995In this case the contract is that the returning value is consistent with
10096the elements held by the collection.
10197
102- ``Var `` supports constraining parametric types to classes with any of
98+ ``TypeVar `` supports constraining parametric types to classes with any of
10399the specified bases. Example::
104100
105- X = Var ('X')
106- Y = Var ('Y', Iterable[X])
101+ X = TypeVar ('X')
102+ Y = TypeVar ('Y', Iterable[X])
107103
108104 def filter(rule: Callable[[X], bool], input: Y) -> Y:
109105 ...
@@ -201,8 +197,8 @@ complex cases, a comment of the following format may be used::
201197
202198 x = [] # type: List[Employee]
203199
204- If type hinting proves useful in general, a variable typing in syntax may
205- be provided in a future Python version.
200+ If type hinting proves useful in general, a syntax for typing variables
201+ may be provided in a future Python version.
206202
207203
208204Explicit raised exceptions
@@ -246,7 +242,7 @@ new members are defined:
246242
247243* Union
248244
249- * Var
245+ * TypeVar
250246
251247All available abstract base classes are importable:
252248
@@ -295,7 +291,7 @@ All available abstract base classes are importable:
295291
296292The following helper types are also provided by the ``typing`` module:
297293
298- * AnyStr, equivalent to ``Var ('AnyStr', str, bytes)``
294+ * AnyStr, equivalent to ``TypeVar ('AnyStr', str, bytes)``
299295
300296* Match and Pattern, types of ``re.match()`` and ``re.compile()`` results
301297
0 commit comments