fork download
  1. def decorator_factory(func, enter_message, exit_message):
  2. # We're going to return this decorator
  3. def simple_decorator(func):
  4. def wrapper():
  5. print enter_message
  6. func()
  7. print exit_message
  8.  
  9. return wrapper
  10.  
  11. return simple_decorator
  12.  
  13. @decorator_factory("How does inner function", "know what f() is?")
  14. def hello():
  15. print "Hello World"
  16.  
  17. hello()
Runtime error #stdin #stdout #stderr 0s 23304KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 13, in <module>
TypeError: decorator_factory() takes exactly 3 arguments (2 given)