Is it possible to have a condition on list iterations? : <p>I was playing around with python lists, and how to generate them on the fly with <code>for</code> statements.</p>

<p>I came across this:</p>

<pre><code>a = [0,1,2,3,4,5]
x = 1/sum([1/b for b in a])
</code></pre>

<p>This however produces a division by zero.</p>

<p>Is it possible to do something like </p>

<pre><code>x = 1/sum([1/b for b in a if b != 0])
</code></pre>

<p>within the condition nested inside the list declaration?</p>
