Skip to content
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

Feature Request: Make variable annotations optional #1534

Closed
saxbophone opened this issue May 15, 2016 · 2 comments
Closed

Feature Request: Make variable annotations optional #1534

saxbophone opened this issue May 15, 2016 · 2 comments

Comments

@saxbophone
Copy link

I think it might be a good idea to make the type-checking of variable declarations optional, by passing an appropriate flag to mypy when running static code checking.

The reason I think this would be useful would be for those who might want to have type-checking of function signatures and the calling of them, but not for declaration of variables.

If the maintainers think this is a feature they'd like to have, some further discussion probably needs to happen regarding how the behaviour is handled (i.e. variable checking being optional versus ignored).

This is following on from observations related to #1164

@gvanrossum
Copy link
Member

I'm not sure there'd be a huge demand for this. In a sense variable annotations are already optional -- except for cases where mypy can't infer the type (mostly for empty containers). If you want signature annotations but don't care about the body being type-checked period, perhaps you should use stub files, which are exactly that.

@saxbophone
Copy link
Author

Aha! Great, thanks @gvanrossum, that looks perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants