title: Pop takes values from beginning of sets on ranges enumerated by one consitently. Is this intended?
body: <p>I'm sorry if this has been asked before, but I can't figure out how this prime sieve uses pop on a set to reliably pull its first/lowest values. </p>
  
  <pre><code>def get_primes(n):
      numbers = set(range(n, 1, -1))
      primes = []
      while numbers:
          p = numbers.pop()
          primes.append(p)
          numbers.difference_update(set(range(p*2, n+1, p)))
      print(primes)
  get_primes(input('Primes under:'))
  </code></pre>
  
  <p>As far as I can tell it seems accurate, which seems to imply that it is consistently popping the smallest (or leftmost) number from the set, <code>numbers</code> , which contradicts my understanding of how sets work (inherently unordered). When trying to use the same methods on ranges enumerated by more than one, I got less predictable results (as originally expected).</p>
  
  <p>I did some testing of my own:</p>
  
  <pre><code>numbers = set(range(15, 1, -1))
  p = numbers.pop()
  P&gt;: 2
  ---------------------------------------------------------
  numbers = set(range(15, 1, -2))
  p = numbers.pop()
  P&gt;: 3
  ---------------------------------------------------------
  numbers = set(range(15, 1, -3))
  p = numbers.pop()
  P&gt;: 9
  ---------------------------------------------------------
  numbers = set(range(15, 4, -1))
  p = numbers.pop()
  p&gt;: 5
  ---------------------------------------------------------
  numbers = set(range(15, 4, -2))
  p = numbers.pop()
  p&gt;: 5
  ---------------------------------------------------------
  numbers = set(range(15, 4, -3))
  p = numbers.pop()
  p&gt;: 9
  </code></pre>
  
  <p>How is the function above not just pulling composite numbers and appending them to the list of primes? Even when the set it's pulling from is no longer enumerated by just one, it seems to work, not only that, but the list of returned primes looks to be completely ordered on magnitudes of ten thousand (and probably higher) . Is it possible to do repeat this for any sets like the ones I tested?</p>
  
  <p>Thanks in advance.</p>
  
  <p>EDIT: After following some links posted in the question linked for duplicates I discovered that sets are ordered based on a values last three binary digits.</p>