Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Open
Description
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.
This should be fine:
def __lt__(self, x: int) -> bool: if isinstance(x, int): return ... return NotImplementedThis should not be fine:
def f() -> bool: return NotImplemented