title: Python lambda with if but without else
body: <p>I was writing some lambda functions and couldn't figure this out. Is there a way to have something like <code>lambda x: x if (x&lt;3)</code> in python? As <code>lambda a,b: a if (a &gt; b) else b</code> works ok. So far <code>lambda x: x &lt; 3 and x or None</code> seems to be the closest i have found.</p>