expression evaluation in if elif statements
<p>Given code like this:</p>

<pre><code>if f(a) == 1:
    # do sth A
elif f(a) == 2:
    # do sth B
elif f(a) == 3:
    # do sth C
else:
    # do sth D
</code></pre>

<p>Does the expression <code>f(a)</code> get executed/evaluated only once? Or does it get executed/evaluated for every case of <code>if</code> or <code>elif</code>? In addition, do compound statements make any difference: e.g.</p>

<pre><code>if f(a) == 1:
    # do sth A
elif f(a) == 2 and a &gt; 0:
    # do sth B
elif f(a) == 3 and a &lt; 0:
    # do sth C
else:
    # do sth D
</code></pre>

<p>In this case, how does <code>f(a)</code> get evaluated? Once for all or individually for each case?</p>
