title: delete items from a set while iterating over it
body: <p>I have a set <code>myset</code>, and I have a function which iterates over it to perform some operation on its items and this operation ultimately deletes the item from the set.</p>
  
  <p>Obviously, I cannot do it while still iterating over the original set. I can, however, do this:</p>
  
  <pre><code>mylist = list(myset)
  for item in mylist:
      # do sth
  </code></pre>
  
  <p>Is there any better way?</p>