-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
Both ClassVar and Final produce runtime errors when used in the body of a TypedDict or NamedTuple.
Mypy already emits an error for Final, but the error message could be clarified.
class TD(TypedDict):
a: Final[int] # E: Final can be only used as an outermost qualifier in a variable annotation
b: ClassVar[int] # Runtime error, no mypy error
class NT(NamedTuple):
a: Final[int] # E: Final name must be initialized with a value \
# E: Final can be only used as an outermost qualifier in a variable annotation
b: ClassVar[int] # Runtime error, no mypy errorFollows from