Skip to content

Return type incompatible with supertype error should specify the types involved #2797

@joshuawarner32

Description

@joshuawarner32

I'm a relatively new user to mypy, and I have a quick bit of feedback / suggestion:

(Tangentially related to #2783 and/or #2782)

I see this error message:

error: Return type of "__iter__" incompatible with supertype "Iterable"

It would be really helpful if the message specified what the return type is, and more helpfully, what mypy thinks it should be.

This is particularly helpful in the context of generic/templated types like Iterable, where reading the definition of the type doesn't immediately give you the answer. In other words: "Oh no! I have to think!" 😃

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions