Python : is there a shortcut for pattern [sth = get_sth() ; if sth: do_a_thing_on(sth)]
<p>HI !</p>

<p>I guess everything is in the question ...
I was just wondering if there is a nice way in Python to shorten this pattern :</p>

<pre><code>something = get_something()
if something:
    do_a_thing_with(something)
</code></pre>

<p>Meaning that I would like  to enter in the <code>if</code> context only if the variable <code>something</code> is not None (or False), and then in this context having this variable set automatically ! Is it possible with <code>with</code> statement ?</p>

<p>PS : I don't want to have to DEFINE more stuff... I am looking for some statement to use on the fly ?!</p>
