Say, I have the following Python code
if obj is None:
identifier = None
else:
identifier = obj.id
where obj is a Python object whose class definition is not included
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.
1 Answer