
June 3, 2008
7:02 p.m.
On 3 Jun 2008, at 19:44, Raymond Hettinger wrote:
Difference is not an associative operation though. E.g.
A.difference(B, C, D) means A - B - C - D which can be (((A - B) - C) - D) or (((A - D) - C) - B) or (((A - C) - B) - D) or (((A - C) - D) - B)
You can do the subtractions from A in any order.
That's true. However there no way to predict the output of this:
set_of_sets = { {1, 2}, {2, 3} } set.difference(*set_of_sets)
And A.difference(B, C, D) could be rewritten as A - set.union(B, C, D) which may be just as clear. -- Arnaud