Skip to content

Instantly share code, notes, and snippets.

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