Hacker News new | past | comments | ask | show | jobs | submit login

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?



You 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.


Okay, it's exactly the pre-C++20 state. That's actually funny.


I 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.


What's not true?

I didn't say that Python was in post-cpp20. Maybe you wanted to comment on my previous comment.


To rewind a bit, you stated "So Python has reverted to the pre-C++20 state..."

Which is the statement I originally took issue with.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: