http://www.learnpython.org/en/Setsから Python を学習しているときに、セット間の symmetric_difference の概念に遭遇しました。セットの「排他的または」操作と同じ出力が得られると思いました。どう違うの?
4236 次
2 に答える
1
Yes, it is pretty much the same, just XOR is an operation on booleans, and symmetric_difference
is an operation on sets. Actually, even your linked documentation page says this:
To find out which members attended only one of the events, use the "symmetric_difference" method
You can also see this more detailed mathematical explanation about relationship between logical XOR and symmetric difference on sets.
于 2015-08-31T11:57:56.873 に答える