I have a code:
from functools import wraps
def my_decorator(f):
@wraps(f)
def wrapper(*args, **kwargs):
print kwargs["name"] # Should display Dean Armada
print 'Calling decorated function'
return f(*args, **kwargs)
return wrapper
@my_decorator(name="Dean Armada")
def example():
"""Docstring"""
print 'Called example function'
example()
What I want to achieve is for my decorator to depend on the kwargs arguments as all of its parameter.. My code above throws this error
my_decorator() got an unexpected keyword argument 'name'