Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def foo(func):
- def wrapper(*args, **kwargs)
- print('I am a decorator')
- return func(*args, **kwargs)
- return wrapper
- @foo
- def bar():
- print('woo! my decorator called me')
- ## this could be accomplished like this as well: foo(bar). the @ operator is what tells python to pass bar into foo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement