On Thu, Dec 26, 2019 at 1:12 PM python-ideas--- via Python-ideas firstname.lastname@example.org wrote:
Andrew Barnert wrote:
On Dec 25, 2019, at 14:57, python-ideas--- via Python-ideas email@example.com wrote:
If I can spend my two cents, I think the fact the most of you prefer | is because is already how sets works. And IMHO it's a bit illogical, since sets also support -. So I do not understand why | was chosen instead of +.
First, what does it matter that sets support -? You could just as well argue that
- for list and str is illogical because int supports - and they don’t.
Subtracting two lists or two strings has no sense, so the comparison is unfair.
Except that it DOES make sense in some contexts. People are far too quick to say that something "makes no sense", implying that there is no sensible way to interpret it. I've seen plenty of people complain that you can't add two strings together (ie that concatenation is fundamentally different from addition), that you can't multiply a list by an integer, that you can't multiply a string by an integer, that you can't divide a string by a string, etc, etc, etc. Okay, so Python only supports the last one for the specific case of paths, but that's actually only *one* logically defensible interpretation of division (another being "split on this substring", and I'm sure there are others).
I'm not asking for Python to support all of those operations, but I do ask people to be a little more respectful to the notion that these operations are meaningful.
On the contrary, on sets you can apply union *and* difference. And since union seems the exact contrary of difference, it's illogical that | is used instead of +.
That said, the set API at this point is consolidated. My only hope is Python does not make the same errors with `dict` or any other type.
(Although really, I think “illogical” is a strange claim to make for any option here. It’s logical to spell the union of two dicts the same way you spell the union of two sets
And see above :)
Of course you have to be careful because it’s only a partial order, and sorting sets that aren’t comparable is usually meaningless
Indeed, what a coder really need is a isstrictsubset() method, not <. Since set1 < set2 has sense, but sorted(sets) have not. So it was better to have set1.isstrictsubset(set2) and **no** <. But, as I said, the ship was sailed for sets.
Mathematically, the subset relationship is a perfectly reasonable ordering, so it makes perfect sense that the "<" operator be used for this meaning.
you seem to have configured your python-ideas-posting address with the name “python-ideas” rather than with a name that can be used to distinguish you from other people. This will make conversations confusing.
............it's python-ideas@***marco.sulla****.e4ward.com ............................
My guess is that you don't have a real name set, so your client has autogenerated a "real name" from the part of your email address before the at sign (the "mailbox" portion). If you set an actual name, it'll come through more readably to everyone else.