Message380614
I am sad that such code (as well as my former code in total_ordering) no longer works, but this is just a clever trick, and the code can be written in less clever but more explicit way.
On other hand, the warning helps to catch common mistakes like
not self.__lt__(other)
self.__lt__(other) or self.__eq__(other)
super().__eq__(other) and self.x == other.x
Even non-beginners often make such kind of mistakes, and it is hard to catch them if you have not trained yourself specially. I suggest you to include lessons about writing complex comparison methods in your course for advanced users. |
|
Date |
User |
Action |
Args |
2020-11-09 20:06:15 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, gvanrossum, rhettinger, terry.reedy, steven.daprano, ethan.furman, josh.r, veky, xtreak |
2020-11-09 20:06:15 | serhiy.storchaka | set | messageid: <1604952375.71.0.89805610544.issue35712@roundup.psfhosted.org> |
2020-11-09 20:06:15 | serhiy.storchaka | link | issue35712 messages |
2020-11-09 20:06:15 | serhiy.storchaka | create | |
|