Skip to content

Instantly share code, notes, and snippets.

@svlasov
Created May 18, 2014 11:44
Show Gist options
  • Save svlasov/faf38b7292c63e5e620b to your computer and use it in GitHub Desktop.
Save svlasov/faf38b7292c63e5e620b to your computer and use it in GitHub Desktop.
Parameterized decorator
def decoratorFunctionWithArguments(arg1, arg2, arg3):
def wrap(f):
print "Inside wrap()"
def wrapped_f(*args):
print "Inside wrapped_f()"
print "Decorator arguments:", arg1, arg2, arg3
f(*args)
print "After f(*args)"
return wrapped_f
return wrap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment