If clause in regular Python for-loop
<p>Is it possible to basically do the following in Python:</p>

<pre><code>for elem in my_list if elem:
    #Do something with elem...
</code></pre>

<p>Note that I want to specifically avoid using map, lambdas, or filter to create a second list that gives the Boolean condition, and I don't want to do the following:</p>

<pre><code>for elem in [item for item in my_list if item]:
    #Do something...
</code></pre>

<p>The latter method requires the construction of the Boolean list too. In my code, my_list can be very, very large.</p>

<p>Basically, the simplest way would be to write</p>

<pre><code>for elem in my_list:
    if elem:
        #Do stuff...
</code></pre>

<p>but I specifically want this all in one line. If all-in-one-line won't make the code actually any different than this last example I gave, that's fine too and I will go with that.</p>
