Why am I getting the above exception from running run the call here. I feel like I am missing something very very obvious..
def decorator_factory(arg1, arg2):
def simple_decorator(f):
def wrapper():
print arg1
f()
print arg2
return wrapper
return decorator_factory
@decorator_factory("what the heck", "what the heck2")
def hello():
print "Hello World"
hello()
It has to be return simple_decorator
instead of return decorator_factory
def decorator_factory(arg1, arg2):
def simple_decorator(f):
def wrapper():
print arg1
f()
print arg2
return wrapper
return simple_decorator # <--- HERE
@decorator_factory("what the heck", "what the heck2")
def hello():
print "Hello World"
hello()