Skip to content

@total_ordering support #4610

Closed
Closed
@srittau

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions