Prohibit type variables inside ClassVar (#254)

Prohibit type variables inside TypeVar
This commit is contained in:
Max 2017-05-25 02:57:27 -07:00 committed by Chris Angelico
parent 4205604fc8
commit 1ef52e9d6a
1 changed files with 4 additions and 0 deletions

View File

@ -229,6 +229,10 @@ Here ``ClassVar`` is a special class defined by the typing module that
indicates to the static type checker that this variable should not be
set on instances.
Note that 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 could be illustrated with a more detailed example. In this class::
class Starship: