> On Dec 26, 2019, at 11:32, Marco Sulla via Python-ideas 
> <python-ideas@python.org> 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<b iff a<=b 
and not a==b for sets, just like for all of the numeric types), or that 
Python’s sort isn’t actually a sort and therefore < isn’t meaningful for any 
type and therefore not for sets, because both are silly.

But it seems like you want to argue both of them, so… I’m not sure what to say 
to that, except that neither of those help make your case that set shouldn’t 
spell subset the same way that int spell less. Let’s go through it:

> 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<b 
or a==b is false, and that doesn’t include set any more than it includes int 
and float.

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

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/E6KN4TAJINQOFIFC6EVHK4BWK2A356VA/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to