In set theory, the + symbol usually denotes a disconnected union of two sets. If A and B are sets, then their disconnected union is defined as the set
A + B = {(a, 1) | a in A} U {(b, 2) | b in B}
those. to build a disconnected union, we mark all the elements of A and all the elements of B with different tags (in the example I used numbers 1 and 2, but any two different things could do this work) and then we take the union of two result sets. In the above example, I used 'U' for set union to make it look more like regular mathematical notation; below I use Python notation, i.e. '|' for union, and '&' for intersection.
If A and B do not intersect, then A + B has a 1-to-1 correspondence with A | B. If this is not the case, then all common elements x in and B appear twice in + B: once (x, 1) and once (x, 2).
So, since the "+" symbol has a fairly established meaning as a given operation, I find it very consistent that Python does not use this symbol to combine or intersect. Python designers probably had this in mind when they selected set operators.
Giorgio Oct 08 2018-11-11T00: 00Z
source share