Skip to content

Instantly share code, notes, and snippets.

@eclecticmiraclecat
Created June 1, 2020 07:53
Show Gist options
  • Save eclecticmiraclecat/789ddb6316a0317a0d832cc58350dbcb to your computer and use it in GitHub Desktop.
Save eclecticmiraclecat/789ddb6316a0317a0d832cc58350dbcb to your computer and use it in GitHub Desktop.
>>> def boo_what(fmt):
... def boo(func):
... def wrapper(*args, **kwargs):
... print(f'BOO {fmt}')
... return func(*args, **kwargs)
... return wrapper
... return boo
...
>>> @boo_what('hello')
... def add(x, y):
... return x + y
...
>>> add(2,3)
BOO hello
5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment