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

Should we eventually type check all function bodies by default? #6646

Open
JukkaL opened this issue Apr 8, 2019 · 1 comment
Open

Should we eventually type check all function bodies by default? #6646

JukkaL opened this issue Apr 8, 2019 · 1 comment

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Apr 8, 2019

One of the more surprising mypy features is that is doesn't type check functions without annotations (see #6643 for an example). New users are particularly likely to hit this issue, but it's generally easy to forget to annotate functions, especially those that don't take any arguments. Maybe we should type check all function bodies by default, and provide an option to fall back to the current behavior. We've made this behavior quite prominent in the documentation, but it still seems to confuse many users.

We'd probably want to reduce the number of false positives before making the switch, but this is something the mypy core team is planning to work on anyway. It may be useful to try to infer the return type automatically as well for this to provide the most benefits.

Thoughts?

@gvanrossum
Copy link
Member

I agree. This has been one of the less successful aspects of gradual typing.

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

No branches or pull requests

2 participants