Skip to content

@total_ordering support #4610

Description

@srittau

Please consider the following code:

from functools import total_ordering
from typing import Any


@total_ordering
class Ord:

    def __eq__(self, other: Any) -> bool:
        return False

    def __lt__(self, other: "Ord") -> bool:
        return False


Ord() <= Ord()

mypy 0.560 (using Python 3.6.4, default flags) complains:

test.py:15: error: Unsupported left operand type for <= ("Ord")

It would be helpful if mypy would support @total_ordering.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions