Skip to content

Instantly share code, notes, and snippets.

@onelharrison
Created December 17, 2020 22:29
Show Gist options
  • Select an option

  • Save onelharrison/37a1d153246a5e1d2336c444f05522a6 to your computer and use it in GitHub Desktop.

Select an option

Save onelharrison/37a1d153246a5e1d2336c444f05522a6 to your computer and use it in GitHub Desktop.
Implementation of the coaselce function in python
def coalesce(*values):
"""Return the first non-None value or None if all values are None"""
return next((v for v in values if v is not None), None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment