Skip to content

Require annotations for all nested functions within an annotated function #1324

Open
@JukkaL

Description

@JukkaL

Mypy currently treats an unannotated function within an annotated function as being dynamically typed, similar to all unannotated functions. However, this can be unexpected, and it's easy to miss nested functions when annotating code because they aren't visually prominent. Perhaps mypy should enforce that nested function are annotated within an annotated function?

Once we have strict mode, it could be used to enforce this as well, but it might be useful have a separate check for this.

(This was suggested by Alex Allain.)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions