I\'m sure there\'s a simpler way of doing this that\'s just not occurring to me.
I\'m calling a bunch of methods that return a list. The list may be empty. If the
The best way is this:
a = get_list() return a[0] if a else None
You could also do it in one line, but it's much harder for the programmer to read:
return (get_list()[:1] or [None])[0]