This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy Amit.Saha, docs@python, georg.brandl, rhettinger, terry.reedy 2013-05-03.20:44:10 -1.0 Yes <1367613850.37.0.736891281413.issue17854@psf.upfronthosting.co.za>
Content
```Sets have methods that do not have operators (such as len, isdisjoint),
operators that do not have non-special methods (such as in, <), and method-operator pairs that do the same thing (such as (union, |), (symmetric_difference, ^)). For the pairs, it gives the method signature and the *equivalent* operator expression. Since .union takes multiple 'other' args, the equivalent operator expression does too. Since .symmetric_difference only takes one 'other' arg, so does the expression.

A coherent proposal would change the method code and doc to the following:

symmetric_difference(other, ...)
set ^ other ^ ...
Return a new set with elements in an odd number of the sets.

s={1,2, 5}
t={2,3, 5}
u={3,4, 5}
print(s^t^u)
>>>
{1, 4, 5}

I believe the proposal was once considered, and rejected. An argument for is that the effect of chained symmetric differences is not obvious, as evidenced by Amit's mistaken characterization. I had to think a bit before I was sure of the answer. An argument against is that what one actually gets is seldom wanted, so that allowing more than two inputs to the method would have little benefit.

What might be done is to document the symmetric different of multiple sets with a parenthetical comment such as

"(The symmetric difference of multiple sets, a ^ b ^ c ^ ..., is a new set with elements appearing in an odd number of input sets.)"

This would let people know what to expect from such expressions, in a situation where the effect is less obvious than usual.```
History
Date User Action Args
2013-05-03 20:44:10terry.reedysetrecipients: + terry.reedy, georg.brandl, rhettinger, docs@python, Amit.Saha
2013-05-03 20:44:10terry.reedysetmessageid: <1367613850.37.0.736891281413.issue17854@psf.upfronthosting.co.za>
2013-05-03 20:44:10terry.reedylinkissue17854 messages
2013-05-03 20:44:10terry.reedycreate