Python: A more concise syntax for variable assignment when accessing a NoneType object
<p>Say, I have the following Python code</p>

<pre><code>if obj is None:
  identifier = None
else:
  identifier = obj.id
</code></pre>

<p>where <code>obj</code> is a Python object whose class definition is not included</p>

<p>I barely remember there's a more concise syntax (like a one-line code?) that can achieve the same. If I wasn't dreaming, can someone please advise what that simpler syntax might be? Thanks.</p>
