title: Difference between union() and update() in sets, and others?
body: <p>Python sets have these methods:</p>
  <pre class="lang-none prettyprint-override"><code>s.union(t)  s | t   new set with elements from both s and t
  
  s.update(t) s |= t  return set s with elements added from t
  </code></pre>
  <p>Likewise, there's also these:</p>
  <pre class="lang-none prettyprint-override"><code>s.intersection_update(t)    s &amp;= t  return set s keeping only elements also found in t
  
  s.intersection(t)   s &amp; t   new set with elements common to s and t
  </code></pre>
  <p>And so on, for all the standard relational algebra operations.</p>
  <p>What exactly is the difference here? I see that it says that the update() versions returns s instead of a new set, but if I write <code>x = s.update(t)</code>, does that means that <code>id(x) == id(s)</code>? Are they references to the same object now?</p>
  <p>Why are both sets of methods implemented? It doesn't seem to add any significant functionality.</p>