8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mypy shows the error of an unsupported comparison operator for classes with @functools.total_ordering decorator and with implemented == and <.
@functools.total_ordering
==
<
Example:
import decimal import functools import typing @functools.total_ordering class Money: def __init__(self, amount: str) -> None: self.amount = decimal.Decimal(amount) def __eq__(self, other: typing.Any) -> bool: if isinstance(other, Money): return self.amount == other.amount return NotImplemented def __lt__(self, other: typing.Any) -> bool: if isinstance(other, Money): return self.amount < other.amount return NotImplemented assert Money('10.00') <= Money('10.00')
Mypy output (--strict flag is enabled):
--strict
money.py:23: error: Unsupported left operand type for <= ("Money")
My configuration:
If it's typeshed related issue, please close it and I will post it there.
typeshed
The text was updated successfully, but these errors were encountered:
Duplicate of #4610
Sorry, something went wrong.
No branches or pull requests
Mypy shows the error of an unsupported comparison operator for classes with
@functools.total_ordering
decorator and with implemented==
and<
.Example:
Mypy output (
--strict
flag is enabled):My configuration:
If it's
typeshed
related issue, please close it and I will post it there.The text was updated successfully, but these errors were encountered: