-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Better message for invalid types like List(int) #4172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Another example that's not immediately obvious is missing parens around input eg
throws message
or
or something else to highlight the issue |
Here's one that took a while to figure out: def update_state(conf, # type: SourceConf
new_state, # type: SourceState
tid, # type: int
vid, # type: int
update_ts=None, # type: Optional[float],
): # type: (...) -> SourceConf This gave spoiler alert . . . . . . . . . . . . . There's an extra comma after |
@gvanrossum Well, #3871 should help a bit in your case. I'd fix it but I'm currently occupied with my PEP. |
Fixes #4172 (at least the original issue brought up there)
It looks like #4323 fixed only part of the problems mentioned here, I am reopening this, just not to lose track. |
The error message "invalid type comment or annotation" isn't very helpful if a user writes
List(int)
instead ofList[int]
(orOptional(int)
). This seems to be a common error.Example:
A better message could be something like this:
The text was updated successfully, but these errors were encountered: