title: Python iter() time complexity?
body: <p>I was looking up an efficient way to retrieve an (any) element from a set in Python and came across this method: </p>
  
  <pre><code>anyElement = next(iter(SET))
  </code></pre>
  
  <p>What exactly happens when you generate an iterator out of a container such as a set? Does it simply create a pointer to the location of the object in memory and move that pointer whenever next is called? Or does it convert the set to a list then create an iterator out of that?</p>
  
  <p>My main concern is if it were the latter, it seems iter() would be an O(n) operation. At that point it would be better to just pop an item from the set, store the popped item in a variable, then re-insert the popped item back into the set. </p>
  
  <p>Thanks for any information in advance!</p>