I realize this is probably something that would be hard to change for
compatibility reasons. Maybe someone can think of a way around that though?
It seems to me that `not NotImplemented` should result in `NotImplemented` and
attempting to convert it to `bool` should raise a `TypeError` exception.
Take the following example:
```
def __lt__(self, other):
return not self.__ge__(other):
def __le__(self, other):
return not self.__gt__(other):
def __ge__(self, other):
<some code that might or might not return NotImplemented>
```
Currently, this will not work because `NotImplemented` is truthy and `not
NotImplemented` is `False`, so it is necessary to complicate the
implementations of `__lt__` and `__le__` to specifically check whether the
value returned from the complementary method returned `NotImplemented` or not.
If the value of `not NotImplemented` was `NotImplemented` then the coding
pattern above would simply work.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/U7GOYMMMBQQPSD45JDNCSOO7VULDZTD6/
Code of Conduct: http://python.org/psf/codeofconduct/