5 ms·
So Python has reverted to the pre-C++20 state but without the ability to redefine other operators? Can you even make a proper custom float type in Python then?
by de_watcher 7y ago
So Python has reverted to the pre-C++20 state but without the ability to redefine other operators? Can you even make a proper custom float type in Python then?
- joshuamorton 7y agoYou can define all the operators explicitly if you wish. However, the common case is made easier, define only __eq__ and one of the others (__gt__ or __le__ usually) and @functools.total_ordering will derive all of the others for you.
- de_watcher 7y agoOkay, it's exactly the pre-C++20 state. That's actually funny.
- joshuamorton 7y agoI don't think that's true, python had no concept of strong vs. weak equality and ordering. cmp returned either -1, 0, or 1 (or at least, it was treated that way). There was no way to describe "unequal, but not orderable". That's the flaw which cpp avoids, although it remains to be seen if implementing complex spaceships is worth it. Or I guess, python is now in the pre-cpp20 state, but was never in the post-cpp20 state, so it didn't revert. Python's cmp was broken.
- de_watcher 7y agoWhat's not true? I didn't say that Python was in post-cpp20. Maybe you wanted to comment on my previous comment.
- joshuamorton 7y agoTo rewind a bit, you stated "So Python has reverted to the pre-C++20 state..." Which is the statement I originally took issue with.