Python Function Return Statement is Confusing and Complex
<p>Could any body explain what do the 'and' and 'or' statements are doing in the return statement of the function below ? 
the function seems to be returning the largest common denominator of a and b.  </p>

<p> <code>def gcd(a,b): return b and gcd(b, a % b) or a</code></p>

<p>Thank you !</p>

<p>The function continuously returns <code>gcd(b, a % b)</code> while <code>b</code> has a truthy value, i.e not equal to zero in this case. </p>

<p>When <code>b</code> reaches <code>0</code> (after consecutively being assigned to the result of <code>a % b</code>), <code>b and gcd(b, a % b)</code> will be <code>False</code> and the value of <code>a</code> will be returned.</p>

python python-2.7 function python-3.x