-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
mypy prints out types in inconsistent formats depending context #1582
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
Yeah, printing types is currently messy and it would be nice to clean it up. PEP 484 doesn't allow printing out all the information about types, such as It may still be nice to have at least two different modes:
|
Yeah, showing stuff like I like the idea of alignment for the type difference mode. I don't think there should be any other difference in how the types are printed, though. In particular, I think we should always print full types and never abbreviate. |
I just stumbled upon this problem as well... I wondered why the error happened only when using classes that I defined (like
which yields the puzzling error:
|
Mypy now shows full types when necessary so this may be closed. |
Mypy has several different ways types can be displayed: the internal representation,
format_simple
, etc. It's confusing that the same type can be printed differently in different places. Also,. none of these formats look quite like the PEP 484 syntax.It'd be really nice to make one canonical way that types are printed, which should look exactly like the PEP 484 syntax (but with slight additional information about type variables when appropriate). I don't think this will even be too hard to write -- the main annoyance will be updating all the tests.
The text was updated successfully, but these errors were encountered: