You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
More precise type checking of NotImplemented and operator overloading #363
NotImplemented should be implicitly a valid return value of operator methods such as __lt__, __add__, but it should be flagged as an error to return it elsewhere (unless, maybe, the return type includes a suitable type such as typing.NotImplementedType).
Currently NotImplemented has type Any which allows it to be used in any context, which is wrong.
(unless, maybe, the return type includes a suitable type such as typing.NotImplementedType).
There is no typing.NotImplementedType at the moment though. I think Literal[NotImplemented] would be more elegant anyway, but that is not accepted by mypy 0.790.
Could we please get some official guidance on how to workaround this issue in the short term?
I understand the complexity at stake here after reading the referenced/referencing issues, but I think it'd be helpful to have an "official workaround" until this gets resolved.
Activity
Ignore mypy warning when returning NotImplemented from Ordering.__eq__
mthuurne commentedon Dec 7, 2020
There is no
typing.NotImplementedTypeat the moment though. I thinkLiteral[NotImplemented]would be more elegant anyway, but that is not accepted by mypy 0.790.type annotate fakeOpen to return object
brianrodri commentedon Aug 8, 2021
Could we please get some official guidance on how to workaround this issue in the short term?
I understand the complexity at stake here after reading the referenced/referencing issues, but I think it'd be helpful to have an "official workaround" until this gets resolved.
From my understanding, the problem is:
0dminnimda commentedon Jul 5, 2022
Are there any updates on this?