Best way to do conditional assignment in python
<p>I tend to use this a lot, but it's ugly:</p>

<pre><code>a = (lambda x: x if x else y)(get_something())
</code></pre>

<p>So I wrote this function:</p>

<pre><code>def either(val, alt):
    if val:
        return val
    else:
        return alt
</code></pre>

<p>So you can do:</p>

<pre><code>a = either(get_something(), y)
</code></pre>

<p>Is there a built-in function for this like isnull in T-SQL? Or am I missing something really obvious?</p>
