Is there a way to get the return value of a function and test it's "nonzero" at the same time?
<p>I have code that looks like this:</p>

<pre><code>if(func_cliche_start(line)):
   a=func_cliche_start(line)
   #... do stuff with 'a' and line here
elif(func_test_start(line)):
   a=func_test_start(line)
   #... do stuff with a and line here
elif(func_macro_start(line)):
   a=func_macro_start(line)
   #... do stuff with a and line here
...
</code></pre>

<p>Each of the func_blah_start functions either return None or a string (based on the input line).  I don't like the redundant call to func_blah_start as it seems like a waste (func_blah_start is "pure", so we can assume no side effects).  Is there a better idiom for this type of thing, or is there a better way to do it?</p>

<p>Perhaps I'm wrong, (my C is rusty), but I thought that you could do something this in C:</p>

<pre><code>int a;
if(a=myfunc(input)){ /*do something with a and input here*/ }
</code></pre>

<p>is there a python equivalent?</p>
