Require annotations for all nested functions within an annotated function
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
Research direction
Start by reviewing mypy's current handling of unannotated nested functions inside annotated functions and how strict mode represents related checks. Clarify whether this should be part of strict mode or a separate check, then define tests showing the expected enforcement and completion criteria.
Written by the indexing model from the issue text.
Description
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.)
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 54
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python/mypy
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug topic-configuration topic-error-reporting
Difficulty 2/5 1-3 hours Newbie friendliness 68/100