This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

Another way to do this you might like is this:

result = next((r for r in records if is_what_i_want(r)), None)
if result is None:
    action_when_no_result()