3 ms·
Yes again, for two sets: a = {1,2,3} b = {1,2,3,6,7,8} len(a) - len(b) == 0 len(a) != len(b) Subtraction on sets does not work like you're
by antt 8y ago
Yes again, for two sets:
a = {1,2,3}
b = {1,2,3,6,7,8}
len(a) - len(b) == 0
len(a) != len(b)
Subtraction on sets does not work like you're suggesting it should.
I don't understand why you're using that to defend broken notation.
The only reason why we have a|b as union is because a∪b is too hard to type
on most keyboards, and we still are trying to catch up to APL when it comes
to math source code.
- zestyping 8y agoI'm not suggesting anything about subtraction on sets. I'm suggesting that + is not appropriate for dictionary merge because it doesn't behave like + on other Python containers. The context is Python, not other languages. In a language that used + for set union, + would also be fine for dictionary merge. But Python isn't like that. Strings, tuples, and lists have + and do not have -, and for all of them the + operator does add lengths. Sets have | and -, and those operators do not add or subtract lengths.