What's the cleanest/ quickest way to get an attribute of object if it exists?
<p>I want to get an attribute on an object if the object exists, otherwise set it to <code>None</code> or empty string or some default. Is there a quick one line way of doing this? </p>

<p>For example in pseudocode:</p>

<pre><code>gender = if Person then Person.gender else ''
</code></pre>
