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 <=. 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
So, **in Python**, sorting a list of set **has no mathematical sense**, because
**you can sort them in any way**, partial or total. They are like NaN. And if
you tried to sort some sets in REPL, as I do, you realized it very fast.
> > "<" 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.
Furthermore, I'm the descendant of Lucius Cornelius Sulla, the first dictator
of Roma. So I should be the Emperor of UE, at minimum :D
And now something completely different.
cdd, come dovevasi dimostrare, sorted(sets) has no sense. I do not want to spit
over the work of people that created a **wonderful** language. But, IMHO, the
set API has some problems.
So, I repeat, I **kindly** hope that set will be not taken as example for
future APIs. I **strongly** hope that the good, old, plus operator will be
chosen, because, as I wrote, **mathematically** has more sense, for sets, dicts
and whatever object needs to be merged to another one.
Peace and love.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/DUIVGNLDDGRZDFU3BQ5FB6GGH53KDVOH/
Code of Conduct: http://python.org/psf/codeofconduct/