Skip to content

Commit

Permalink
fallback in first()
Browse files Browse the repository at this point in the history
  • Loading branch information
rgaudin committed Jul 1, 2021
1 parent 5ccc8d5 commit 114440f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sotoki/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def get_short_hash(text: str) -> str:


def first(*args: Iterable[object]) -> object:
"""first non-None value from *args"""
return next(item for item in args if item is not None)
"""first non-None value from *args ; fallback to empty string"""
return next((item for item in args if item is not None), "")


def rebuild_uri(
Expand Down

0 comments on commit 114440f

Please sign in to comment.