@dataclass(frozen=True, eq=True, order=True)
class C:
x: int
l = [C(1), C(2), C(1)]
print(sorted(l))
The above code works but gives a warning:
Expected type 'Iterable' (matched generic type 'Iterable[SupportsLessThanT]'), got 'list[C]' instead
.
I think the order=True
param passed to @dataclass
should result in generation of __lt__
etc and thus confirm to SupportsLessThanT
?
An explicit implementation of __lt__
silences the warning, but how do I silence it without?