[Python-ideas] Implement __add__ for set and frozenset

Jacob Holm jh at improva.dk
Tue Jun 3 21:43:09 CEST 2008


Arnaud Delobelle wrote:
>
> Difference is not an associative operation though. E.g.
>
> A - (B - B) = A but (A - B) - B = A - B
>
> Same for symmetric difference (here "^" stands for symmetric 
> difference). E.g.
>
> A ^ (B ^ B) = A but (A ^ B) ^ B = A | B
>

Actually, symmetric difference *is* associative. The second '=' above is 
wrong unless B is a subset of A.

Regards

Jacob



More information about the Python-ideas mailing list