title: Python and set() operations ... & and ^
body: <p>I'm trying to do some JSON document comparisons by using python 2.7 sets.
  I have scrubbed the py docs to understand set operations</p>
  
  <p>In previous code, I make sure the JSON docs have exact Field matches</p>
  
  <pre><code># convert the JSON to two set() for later operations
  currSet = set(currJSON.items())
  prevSet = set(prevJSON.items())
  
  match   = currSet &amp; prevSet 
  unmatch = currSet ^ prevSet
  
  log.info('%d, %d, Matched: %d, UnMatched: %d' % (len(currSet), len(prevSet), len(match), len(unmatch))
  </code></pre>
  
  <p>I always get len(currSet)==len(prevSet)
  and expect len(currSet) == len(match)+len(unmatch)</p>
  
  <pre><code>match = S1 &amp; S2  # this is the intersection, elements in both sets
  umatch = S1 ^ S2  # this is the outersection, elements in (S1 not S2) and (S2 not S1)
  </code></pre>
  
  <p>Shouldn't: len(match) + len(umatch) == len(S1)</p>
  
  <p>Something ain't clicking in my brain ....</p>