title: Python Primes iterator using count()
body: <p>I am trying to understand how the primes iterator works, the code was taken from a lecture. 
  I searched for count() but found only methods for lists, objects, I just do not understand how the line <code>self._candidates = count(1)</code> works and what it means.
  where is the object we are trying to count 1 in? and the further use of it <code>self._candidates.next()</code> is also very confusing.
  I mainly code in java albeit know basic python.
  here is the code: </p>
  
  <pre><code>class Primes(object):
      def __init__(self):
          self._candidates = count(1)
      def __iter__(self): return self
      def next(self):
          item = self._candidates.next()
          if item &gt; 1:
              self._candidates = FilterMultiplies(self._candidates, item)
          return item
  
  class FilterMultiplies(object):def __init__(self, seq, n):
      self._seq = iter(seq)
          self._n = n
      def __iter__(self): return self
      def next(self):
          item = self._seq.next()
          while item % self._n == 0:
              item = self._seq.next()
          return item
  </code></pre>