Skip to content

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

Open
@JukkaL

Description

@JukkaL

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?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions