You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from mypy_extensions import TypedDict
T = TypedDict('T', {'a': float, 'b': float, 'c': float})
foo: T = {'a': 0.0, 'b': 0.0, 'c': 0.0}
for key in ('a', 'b', 'c'):
foo[key] = 1.0
mypy currently (0.730) complains about that last line, saying error: TypedDict key must be a string literal; expected one of ('a', 'b', 'c'). It's understandable, but limiting - it'd be great if mypy could recognise that key is in fact one of the valid keys for T.
Morikko, jamesbraza, austinbutler, alexsteele, si14 and 15 more