Python: MyPy variable annotations
In Python 3.6, variables (in global, class or local scope) can now have type annotations using either of the following two forms:
foo: Optional[int]
bar: List[str] = []
Mypy fully supports this syntax, interpreting them as equivalent to:
foo = None # type: Optional[int]
bar = [] # type: List[str]
Via MyPy .
Leave a comment