Converting a piece of C++ to Python
<p>I'm trying to convert this C++ to Python. I practice Python only and haven't touched C/C++ yet.</p>

<pre><code>int phi(const int n)
{
  // Base case
  if ( n &lt; 2 )
    return 0;

  // Lehmer's conjecture
  if ( isprime(n) )
    return n-1;

  // Even number?
  if ( n &amp; 1 == 0 ) {
    int m = n &gt;&gt; 1;
    return !(m &amp; 1) ? phi(m)&lt;&lt;1 : phi(m);
  }

  // For all primes ...
  for ( std::vector&lt;int&gt;::iterator p = primes.begin();
        p != primes.end() &amp;&amp; *p &lt;= n;
        ++p )
  {
    int m = *p;
    if ( n % m  ) continue;

    // phi is multiplicative
    int o = n/m;
    int d = binary_gcd(m, o);
    return d==1? phi(m)*phi(o) : phi(m)*phi(o)*d/phi(d);
  }
}
</code></pre>

<p>Most of it is straightforward to convert, it just requires looking up C++ operators. However, this bit:</p>

<pre><code>      for ( std::vector&lt;int&gt;::iterator p = primes.begin();
        p != primes.end() &amp;&amp; *p &lt;= n;
        ++p )
</code></pre>

<p>What does it mean in Python?</p>
