Skip to content

Stricter equality checks? #1271

Closed
Closed
@averagehat

Description

@averagehat

It would be nice if there was a way to enforce a constraint on __eq__ -- maybe a warning? I almost never want to do the following

def test_operator(): # type: () -> None
    1 == "1"
# produces no complaints

While that check may make sense in a world of vanilla python, I'd argue it doesn't make much sense within mypy's world (especially if the arguments are explicitly typed as different types; i.e., one is not a subtype of the other).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions