On Dec 26, 2019, at 11:32, Marco Sulla via Python-ideas
wrote: Andrew Barnert wrote:
the operator is ⊂. "<" operator is used for comparison, and it's vital for sorting. Yes. It’s the defining operation for the partial order in a poset (partially ordered set). And when studying posets generically, you always spell the operation <.
Nope.
Usually, you define the operation <=.
I didn’t want to get into that, because I assumed you weren’t going to argue that <= makes sense for sets but < doesn’t (especially given that a
And posets requires that set1 <= set1 == True and this is true. Unluckily, sort operations in Python requires and uses **only** `__lt__()`. And set1 < set1 == False
Sure, just like with int.
So, **in Python**, sorting a list of set **has no mathematical sense**,
So sorting a list of int has no mathematical sense? Surely you can’t mean that. But if you replace the word “set” with “int” in your argument, it’s exactly as valid.
because **you can sort them in any way**, partial or total.
I’m not sure what this means. You can’t choose whether to sort them partially or totally; you either have a totally ordered collection of sets or you don’t. If it’s totally ordered, sorted gives you a meaningful sort (and one that preserves input order if there are duplicates), just as with totally ordered values of any other type. And if you have a collection of sets that isn’t totally ordered, it behaves in a well defined but usually not particularly useful way, just as with any other type—as you clearly realize:
They are like NaN.
Exactly.
So are you arguing that int < is fine but float < is mathematically nonsense? If not, then why is the fact that set < is like float < an argument that set comparison shouldn’t be spelled
Also, I’m not sure why you think this would be different if Python sorted were defined on <= instead of <. This would only affect types for which a<=b iff a
"<" was clearly chosen only because is graphically similar to ⊂, without
thinking about the consequences.
You’ve got it backward. Historically [...] Hey, I'm Roman. Historically, I should be the citizen of the capital of the whole Europe, part of Middle East and North Africa.
Ok. And if someone were trying to claim that as a Roman you’re not European, because the EU just invented a definition for convenience without thinking about the fact that it makes no sense, this history would be a good counter argument. It doesn’t just counter the claim that the definition is a spurious and thoughtless recent invention, it also makes it blatantly obvious that the definition makes sense. Just like history is a good counter argument to your claim that Python invented < for sets for convenience without thinking about the fact that it makes no sense. It doesn’t just counter the claim that Python’s definition is a spurious and thoughtless recent invention, it also makes it blatantly obvious that the definition makes sense.