14 Sep
2022
14 Sep
'22
1:25 a.m.
* Can ClassVars wrap a TypeVar T? Mypy forbids it, whereas Pyre allows it. Afaik this is not addressed in the specification, so we probably want to standardize it. PEP 526 [1] says, "a ClassVar parameter cannot include any type variables, regardless of the level of nesting: ClassVar[T] and ClassVar[List[Set[T]]] are both invalid if T is a type variable." This language was introduced by peps PR 254 [2]. PR 239 [3] and mypy issue 2878 [4] have more context. -Erik [1] https://peps.python.org/pep-0526/#class-and-instance-variable-annotations [2] https://github.com/python/peps/pull/254 [3] https://github.com/python/peps/pull/239 [4] https://github.com/python/mypy/issues/2878