Skip to content

Instantly share code, notes, and snippets.

@sepulchered
Created November 8, 2017 22:01
Show Gist options
  • Save sepulchered/d65ad2e43106a4c0e0373f1a491bbf6a to your computer and use it in GitHub Desktop.
Save sepulchered/d65ad2e43106a4c0e0373f1a491bbf6a to your computer and use it in GitHub Desktop.
class Just:
def __init__(self, value):
self.value = value
def __repr__(self):
return f'Just {self.value}'
def maybe(fn):
@functools.wraps(fn)
def wrapper(*args, **kwargs):
try:
return Just(fn(*args, **kwargs))
except Exception:
return None
return wrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment