Skip to content

Warn about unannotated functions containing annotations #4166

Closed
@gvanrossum

Description

@gvanrossum
Member

I found some examples (https://bugs.python.org/issue28936) of functions that have no signature annotations but contain local variable annotations. These are currently ignored. I think we should actually warn whenever an annotation (either a type comment or PEP 526 style) occurs in an unannotated function, since it likely reflects some kind of misunderstanding about annotations.

Or at the very least we should have an option to warn about such things.

(IIRC we recently doused a similar source of confusion, but I can't recall the details.)

Activity

ilevkivskyi

ilevkivskyi commented on Oct 26, 2017

@ilevkivskyi
Member

Isn't this a duplicate of #3948? Or am I missing something?

gvanrossum

gvanrossum commented on Oct 26, 2017

@gvanrossum
MemberAuthor

How quickly we forget. :-)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @gvanrossum@ilevkivskyi

        Issue actions

          Warn about unannotated functions containing annotations · Issue #4166 · python/mypy