Comment

Comment by nostoc

Instead of catching the `StopIteration` exception, you can simply provide a default case to `next` :

    next((c for c in candidates if predicate(c)), default)
parent nostoc 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton