Message363961
| Author | serhiy.storchaka |
|---|---|
| Recipients | ethan.furman, gvanrossum, josh.r, serhiy.storchaka, steven.daprano, terry.reedy, veky, xtreak |
| Date | 2020-03-11.19:50:30 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1583956230.81.0.519706569341.issue35712@roundup.psfhosted.org> |
| In-reply-to |
| Content | |
|---|---|
No.
First, it is impossible. nb_bool and PyObject_IsTrue() can return only three value: 1 for true, 0 for false, and -1 for error. It is not possible to represent NotImplemented without breaking all extensions.
Currently
if not a:
b()
else:
c()
is equivalent to
if a:
c()
else:
b()
If a is NotImplemented, what branch be executed in every case?
Second, it would not help. Because real-world examples are not always so trivial as "return not self.__lt__(other)". It may be a part of more complex expression, e.g.:
return super().__eq__(other) and self.attr == other.attr
So it may help in some examples, but make bugs in other examples even more mystical. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2020-03-11 19:50:30 | serhiy.storchaka | set | recipients: + serhiy.storchaka, gvanrossum, terry.reedy, steven.daprano, ethan.furman, josh.r, veky, xtreak |
| 2020-03-11 19:50:30 | serhiy.storchaka | set | messageid: <1583956230.81.0.519706569341.issue35712@roundup.psfhosted.org> |
| 2020-03-11 19:50:30 | serhiy.storchaka | link | issue35712 messages |
| 2020-03-11 19:50:30 | serhiy.storchaka | create | |