I have come across this:
item = someSortOfSelection() if item in myList: doMySpecialFunction(item)
but sometimes it does not work with
If you want to find one element or None use default in next, it won't raise StopIteration if the item was not found in the list:
None
next
StopIteration
first_or_default = next((x for x in lst if ...), None)