Decorating a function f with
@announce causes a line announcing the call to be printed before each call to f. Thanks to the
functools.wraps(f) decorator, the wrapper function adopts the name and docstring of the wrapped one, which is useful, for example, when calling the built-in
help on such a decorated function.
@announce def someFunction(): print()
f = someFunction()
Due to how def announce() uses @functiontools.wrap, calling someFunction() will call wrap() then someFunction(). someFunction() is called inside wrap().
Share this highlighthttp://www.safaribooksonline.com/a/python-in-a/20725486/