Closed
Description
The error message "invalid type comment or annotation" isn't very helpful if a user writes List(int)
instead of List[int]
(or Optional(int)
). This seems to be a common error.
Example:
from typing import List
def f():
# type: () -> List(int) # invalid type comment or annotation
return [1]
A better message could be something like this:
program.py:3: error: Syntax error in type annotation
program.py:3:note: Suggestion: Use List[...] instead of List(...)