Hello,
I am in the process of adding type annotations to some legacy code.
Below is a minimal example illustrating my issue. I apologize for providing the source code as a screenshot, but I wanted to highlight that Pyright, in the strict mode, underlines the methods __eq__
and __ne__
, but not __lt__
and __gt__
.
The error message generated by Pyright is as follows:
Method "__eq__" overrides class "object" in an incompatible manner
Parameter 2 type mismatch: base parameter is type "object", override parameter is type "File"
"object" is incompatible with "File"
I have researched this issue and found advice suggesting the use of other: object
and checking the actual type with isinstance
.
But I feel there is something missing. Could someone provide more insight into the rationale behind the varied typeshed implementations of __eq__
/__ne__
and __lt__
/__gt__
?"